Overview
The Citizen skin features a sophisticated dark mode implementation with support for automatic theme detection, manual selection, and additional dark theme enhancements. The theme system uses CSS custom properties for seamless switching and provides multiple customization options.Dark mode is part of the preferences system and requires no server-side configuration - it works entirely client-side.
Theme Options
Users can choose from three theme modes:Auto (System Theme)
Value:osAutomatically follows the operating system’s theme preference using the
prefers-color-scheme CSS media query.
Light (Day)
Value:dayAlways uses the light theme regardless of system preferences.
Dark (Night)
Value:nightAlways uses the dark theme regardless of system preferences.
Accessing Theme Settings
- Click the preferences button in the header
- Preferences panel opens
- Find Color under the Appearance section
- Select your preferred theme:
- Auto - Follow system theme
- Light - Always light
- Dark - Always dark
- Theme applies immediately
Theme preference is stored in browser localStorage and persists across sessions.
Dark Theme Enhancements
When dark theme is active (either via Auto or manual selection), additional preferences become available:Pure Black Mode
Type: Toggle switchAvailable: Only in dark theme Replaces the standard dark gray background (
#1a1a1a) with pure black (#000000).
Benefits:
- OLED/AMOLED displays - Pixels fully turn off, saving battery
- Maximum contrast - True black provides highest contrast ratio
- Reduced eye strain - Some users prefer pure black backgrounds
- Battery savings - OLED screens use less power with black pixels
Image Dimming
Type: Toggle switchAvailable: Only in dark theme Reduces the brightness of images to prevent harsh contrast in dark environments. Purpose:
- Reduce eye strain - Bright images can be jarring in dark theme
- Better reading experience - Maintains focus on text content
- Comfortable viewing - Especially useful at night
Image dimming uses CSS opacity to reduce brightness. Hovering over images temporarily restores full brightness.
Technical Implementation
CSS Custom Properties
The theme system relies on CSS custom properties (CSS variables) for color values:Theme CSS Classes
When a user selects a theme, a CSS class is applied to the<html> element:
prefers-color-scheme media query:
Storage and Persistence
Theme preference is stored using MediaWiki’s client preferences API:- localStorage key:
mwclientprefs-skin-theme - Value:
os,day, ornight - Scope: Per-domain, per-browser
Theme Preview Colors
The preferences UI shows visual previews of each theme option using computed CSS values:Color Design System
Surface Colors
Layered surface colors create depth:Text Colors
Hierarchy through text colors:Semantic Colors
Meaning through color:Accessibility
Contrast Ratios
The dark theme maintains WCAG AA contrast ratios:- Normal text: Minimum 4.5:1
- Large text: Minimum 3:1
- UI components: Minimum 3:1
Color Scheme Meta Tag
The theme sets thecolor-scheme CSS property:
- Which color scheme is active
- How to render form controls
- How to style scrollbars
- Default colors for
<canvas>, etc.
Respecting System Preferences
The auto theme respectsprefers-color-scheme:
Best Practices
For Users
Image dimming is personal preference. Try it to see if it improves your reading experience in dark mode.
For Developers
Test your custom CSS in both light and dark themes to ensure good contrast and readability.
Integration with Extensions
Extensions can react to theme changes:Color Tokens Reference
Key color tokens used in dark theme:Backgrounds
Text
Interactive
Borders
Troubleshooting
Theme Not Switching
Problem: Selected theme doesn’t applySolutions:
- Clear browser cache and localStorage
- Hard refresh (Ctrl+Shift+R)
- Check browser console for errors
- Verify JavaScript is enabled
Colors Look Wrong
Problem: Some elements have incorrect colorsSolutions:
- Ensure custom CSS uses CSS variables
- Check for hard-coded color values
- Verify CSS specificity isn’t overriding theme
- Test with extensions disabled
Pure Black Mode Not Working
Problem: Pure black preference has no effectSolutions:
- Verify dark theme is active
- Preference only appears in dark mode
- Check localStorage for preference value
- Hard refresh to apply CSS changes
Future Enhancements
Potential future dark theme features:- Custom accent colors - User-selectable theme accents
- Scheduled themes - Auto-switch at specific times
- Granular image control - Per-image dimming settings
- Contrast presets - High/low contrast variations
- Custom color schemes - User-defined color palettes