How it works
A theme is just a set of colors. Light mode uses dark text on light backgrounds, dark mode flips that. The interesting part for testers is who decides which theme the user gets, and when it changes.
- The system has a setting. iOS (Settings › Display & Brightness), Android 10+ (Settings › Display › Dark theme) and desktop operating systems all have Light, Dark and often an Automatic option that switches at sunset or on a schedule.
- The app reads the system setting. On launch, the app asks the OS “light or dark?” and picks its colors. Well-built apps use semantic colorsSemantic colorA named color such as 'label' or 'background' that has a light and a dark value.Open in glossary → like “label” or “background” that have a light and a dark value, instead of one fixed color such as pure black (written
#000000as a hex code, the six-character way of writing a color for screens). - The app may have its own setting. Many apps offer Settings › Appearance: System / Light / Dark. “System” follows the phone. “Light” or “Dark” overrides it, and the choice must be saved so it survives a restart.
- The theme can change while the app is open. Automatic mode flips at sunset, or the user opens Control Center or Quick Settings and taps Dark mode. The app must redraw every visible screen without losing what the user was doing.
- Websites follow the browser. A site asks the browser whether the user prefers light or dark, and the browser takes the answer from the operating system (some sites also offer their own toggle). In CSS this preference is called
prefers-color-scheme; you’ll meet that name in DevTools and in bug reports. If the theme is applied too late, the page flashes whiteFlash of unstyled contentThe page briefly shows the wrong styles or theme before the right ones load.Open in glossary → before turning dark.
Who wins: system or app?
| Phone setting | In-app setting | The user should see |
|---|---|---|
| Light | System | Light |
| Dark | System | Dark |
| Dark | Light | Light (the app overrides the phone) |
| Light | Dark | Dark |
That’s four combinations already, and each one should survive a restart, a theme change while the app is open, and a fresh install. Try them in the lab below.
Switching while the app is open
This is where the platform differences show up:
- Android treats a dark theme change as a configuration changeConfiguration changeAn Android event like rotation, folding, dark mode, font size or language that recreates the screen by default.Open in glossary →, just like rotating the phone. By default, the visible screen is destroyed and recreated. If the app doesn’t save its state, a half-written review or a scroll position disappears the moment the theme flips. It’s the same family of bugs as in Orientation and screen sizes.
- iOS keeps the screen alive and simply tells the app that the appearance changed. Semantic colors update automatically, but anything the developer drew once and cachedCacheStored copies of data or files that make apps and websites load faster.Open in glossary → (a custom chart, a generated image, a color stored in a variable) can stay in the old theme until you leave the screen.
Dev note
iOS calls this a trait change: theuserInterfaceStyletrait goes from light to dark. - Web: the page doesn’t reload. Colors that come from the site’s style sheet switch live. Colors set by a script can stay in the old theme until you reload the page.
Dev note
CSS inside aprefers-color-schememedia query updates by itself. Colors set by JavaScript only update if the code listens for the change.
Try it: the theme lab
Flip the phone’s appearance, the in-app setting and Increase contrast. The badge shows which theme the user actually gets. Then pick an element and measure its contrast ratioContrast ratioHow different text and background colors are; WCAG asks for at least 4.5:1 for normal text.Open in glossary → in both themes. That’s a number for how much a color stands out from its background: 1:1 means the two are the same color (invisible), 21:1 is black on white, and normal text needs at least 4.5:1. The sample screen has a few realistic flaws in its default colors. Can you find which elements fail, and in which theme?
Phone appearance
In-app setting
Accessibility
The user sees the light theme. The in-app setting is "System", so the app follows the phone: light.
Wallet
Updated 2 min ago
Balance
€2,480.15
Wallet
Updated 2 min ago
Balance
€2,480.15
Contrast checker
Text: WCAG AA needs at least 4.5:1 for normal-size text. The dashed outline shows the measured element.
Example requirements
Notice criteria 3 and 9: they’re about timing, not colors. Many teams test the “steady state” of each theme and never the moment of switching.
Check this part
The phone is set to Dark. In the app, Settings › Appearance is set to Light. What should the user see?
On Android, you switch to dark mode while writing a review and the text disappears. Why is this common?
A grey caption has 4.8:1 contrast on white and 4.3:1 on black. Which statement is true?