Dark Mode & Adaptive Themes: UI Design Standards for Multi-Device Environments
Dark mode and adaptive themes let a website change its colors to match the device, the room, and the person’s settings. A phone at midnight, a laptop in an office, and a TV across the room each need a different palette, and one fixed set of colors rarely works for all three. This guide covers eight UI standards for building themes that stay readable and consistent, with working color values, the WCAG rules behind them, and the code to ship them.
What is Dark Mode?
Dark mode is a color scheme with light text and icons on dark surfaces. Operating systems, browsers, and apps offer it as a setting, and many people switch it on in dim rooms or at night.
A good dark theme gets its own palette. Designers pick surface, text, and accent colors that work together on a dark base, since a simple color inversion breaks contrast and hierarchy.
What Are Adaptive Themes?
An adaptive theme is a system that chooses which appearance to show, based on signals from the person and the device. Dark mode is one appearance, and the adaptive theme decides when to use it.
Browsers expose four signals:
| Signal | What it tells your site | How you read it |
|---|---|---|
| Color scheme preference | Whether the device is set to light or dark | prefers-color-scheme |
| Contrast preference | Whether the person wants more or less contrast | prefers-contrast |
| Forced colors | Whether the system overrides your colors, as Windows contrast themes do | forced-colors |
| User choice | The Light, Dark, or System option inside your product | Your own toggle |
Adaptive themes sit next to two layout ideas with similar names. Responsive design stretches a flexible layout to any screen width. Adaptive layout switches between set layouts for phones, tablets, and desktops. Adaptive themes handle colors and contrast, and that is the topic of this article.
Why Do Multi-Device Environments Make This Hard?
Each screen type behaves differently, and each room adds its own lighting. An OLED phone at midnight, an LCD laptop in an office, and a TV in a living room all show the same interface in different ways. Sites built with mobile-first design handle screen size well, but lighting and device settings need their own planning.
People differ as well; light mode usually works better for people with normal vision, and some people with conditions such as cataracts may prefer dark mode. Windows contrast themes add another layer by replacing your colors entirely.
A flexible system covers all of these cases, and a single fixed palette covers only some of them.
Eight UI Design Standards for Dark Mode and Adaptive Themes
| # | Standard | Do | Avoid |
|---|---|---|---|
| 1 | Base color | Dark gray such as #121212 | Pure black as the main background |
| 2 | Depth | Lighter surfaces for higher layers | Depending on drop shadows |
| 3 | Color system | Semantic tokens | Hard-coded hex values in components |
| 4 | Contrast | Check every pair in every theme | Reusing light-mode ratios |
| 5 | Text and brand color | Adjusted accents, regular-weight body text | Unchanged light-mode colors |
| 6 | Component states | Hover, focus, error, and disabled, all themed | Styling only the default state |
| 7 | Images and logos | Transparent assets and dark variants | Opaque white image backgrounds |
| 8 | User control | Light, Dark, System, remembered | Forcing a single theme |
A running example appears throughout: a newsletter sign-up card with an email field and a Subscribe button.
-
Use Dark Gray for the Base Color
Pick a dark gray for the page background. Pure black (#000000) sits at the bottom of the scale, which leaves nowhere darker to go when you need depth, and white text on it produces very sharp contrast.
On OLED screens, true black switches pixels off completely, and some teams choose it on purpose for battery gains. A dark gray base still gives a comfortable surface and leaves room for layers.
Tip: Use an off-white such as #F2F2F2 for body text. It measures 16.73:1 against #121212, which is generous, and it reads softer than pure white. -
Build Depth with Lighter Surfaces
Shadows fade into dark backgrounds, so lighter surfaces take over their job. The higher the layer sits, the lighter its color.
Layer Example color Used for Base #121212 Page background Raised #1E1E1E Cards and panels Highest #2A2A2A Menus and dialogs In the newsletter example, the card sits on #1E1E1E above a #121212 page. A transparent border keeps the card edge visible in Windows contrast themes, since those themes remove shadows and replace background colors.
-
Name Colors by Their Job
A design token is a named color that describes its role, such as
--bg,--text, or--accent. Components use the name, and the active theme supplies the value. A button asks for--accentand receives the right color in either theme, so one change updates the whole interface.CSS has a function for this. light-dark() takes two values, one per theme, and returns the one that matches. It works when color-scheme: light dark is set, and it reaches Baseline status.
:root { color-scheme: light dark; } :root { --bg: light-dark(#FFFFFF, #121212); --surface: light-dark(#F5F5F5, #1E1E1E); --text: light-dark(#1A1A1A, #F2F2F2); --text-muted: light-dark(#595959, #B3B3B3); --accent: light-dark(#1A73E8, #8AB4F8); --on-accent: light-dark(#FFFFFF, #121212); --link: light-dark(#1558B0, #8AB4F8); --field-border: light-dark(#767676, #8A8A8A); --error: light-dark(#C5221F, #F28B82); }In practice, each line pairs a light value with a dark value for the same job, and every component reads these names. The color-scheme property also styles built-in controls and scrollbars to match the theme. Baseline status describes broad browser support, and cross-browser compatibility gaps in embedded WebViews or older browsers still need the fallback shown in the implementation section.
-
Make Dark Mode Accessible: Check Contrast in Both Themes
WCAG 2.2 sets these minimums at level AA:
- 4.5:1 for normal text (Success Criterion 1.4.3)
- 3:1 for large text, meaning 18 point or 14 point bold (1.4.3)
- 3:1 for interface parts such as input borders and icons (1.4.11)
Contrast shifts with every background. Here is one blue on four of them:
Color Background Ratio Result for text #1A73E8 #FFFFFF 4.51:1 Passes #1A73E8 #F5F5F5 4.13:1 Fails #1A73E8 #1E1E1E 3.70:1 Fails #8AB4F8 #1E1E1E 7.91:1 Passes The fix is a different token value per theme. In the token block above,
--accentbecomes the lighter #8AB4F8 in dark mode, and text links use the deeper #1558B0 in light mode (6.31:1 on #F5F5F5).Error red follows the same pattern. #D93025 on #1E1E1E measures 3.49:1, so dark mode uses #F28B82 at 6.98:1. Placeholder text counts as text and needs 4.5:1 as well. Run these checks for every token pair in every theme and record the results next to the token values, so later changes stay safe.
-
Adjust Text, Icons, and Brand Colors
Saturated brand colors can glare on dark surfaces. Shift them to lighter, softer versions for dark mode and keep the hue recognizable, so the brand stays consistent. Contrast ratios settle the exact values, and the checks in Standard 4 confirm them.
Type weight matters too; thin fonts get swallowed on dark backgrounds, and very thick fonts can bleed. Regular weight suits body copy, and the same sizes and line heights apply in every theme. Icons follow the same logic: keep one stroke weight across themes and give each icon at least 3:1 contrast.
-
Define Every Component State
A theme includes a color for each state of each component:
- Hover and pressed
- Keyboard focus
- Selected
- Error and success
- Disabled
Focus deserves extra attention. WCAG 2.4.7 (Focus Visible) requires that keyboard focus is visible, and a blue ring that vanishes on a charcoal card fails that requirement. For the ring itself, 1.4.11 asks for 3:1 contrast on the visual information that shows a component state, and a focus indicator is part of that. Check the ring against the card behind it in each theme.
Status needs more than color (WCAG 1.4.1). In the newsletter card, an invalid email gets a red border, an error icon, and a text message. Disabled components are exempt from contrast requirements, and they should still look clearly disabled, so people understand why a control is unavailable.
-
Adapt Images, Logos, and QR Codes
Opaque white image backgrounds appear as bright rectangles on dark pages. Use transparent PNG or SVG files or supply a dark-friendly version.
- Logos: keep a light and a dark variant with the same shape and brand colors.
- Illustrations: check any with a baked-in white background.
- QR codes: keep them dark on light, since scanners expect that polarity.
The HTML <picture> element can swap images with a prefers-color-scheme media query. That query follows the operating system setting, so a site with its own toggle needs CSS or JavaScript that reads the theme attribute for the swap to match the toggle.
-
Let People Choose, and Remember the Choice
Offer three options: Light, Dark, and System. The system follows the device, and the other two override it.
Save the choice itself (light, dark, or system). Saving only the resolved result would stop System from following later device changes. A small script in the page head, placed before the CSS, applies the saved choice early and prevents a white flash on load.
How Do Adaptive Themes Behave on Each Device?
The standards above apply everywhere, and their effect differs by screen technology and operating systems. This table shows where that difference matters most.
| Device or setting | What happens | Design response |
|---|---|---|
| OLED phone | Dark pixels draw less power. Purdue University tested four Android OLED phones across six apps, 60 seconds per app: dark mode saved 3% to 9% power at 30% to 50% brightness and 39% to 47% at 100% brightness | Treat savings as a bonus, most visible outdoors at high brightness |
| LCD laptop or monitor | The backlight runs at constant power | Choose themes for comfort and readability |
| Android | An expanded dark theme can darken apps that lack their own, and Google recommends building a native dark theme | Ship real dark styles for your Android app and web content |
| iOS and iPadOS | Home screen icons offer default, dark, clear, and tinted appearances | Provide an icon variant for each |
| Windows contrast themes | The system overrides colors and removes shadows | Add CanvasText borders so components keep their edges |
| Increased contrast setting | People ask for stronger separation | Add prefers-contrast styles |
Battery savings depend on screen brightness, how much of the screen shows dark content, and the device. Treat numbers as a guide for other devices. Battery savings depend on screen brightness, how much of the screen displays dark content, and the device itself. Use these numbers as a general guide, since results may vary across devices. Android’s expanded dark theme can darken WebViews, but Flutter apps retain their original design. So, test both web apps and native apps.
How Do You Implement an Adaptive Theme?
This section is for developers. Three steps cover a typical website, and a table at the end covers apps.
Step 1: Set up the tokens. Use the light-dark() block from Standard 3. For browsers that lack light-dark(), declare the light values first and override them inside @media (prefers-color-scheme: dark).
Step 2: Add the user choice. Place this script in the <head>, before any CSS:
<script>
try {
var t = localStorage.getItem('theme');
if (t === 'light' || t === 'dark') document.documentElement.dataset.theme = t;
} catch (e) {}
</script>
Then connect the attribute to color-scheme:
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
The toggle is a radio group with Light, Dark, and System. Choosing System removes the attribute and the stored value, which hands control back to the device. Listening for the storage event keeps open tabs in sync.
Step 3: Respond to contrast and forced colors.
@media (prefers-contrast: more) {
:root {
--text-muted: light-dark(#404040, #D9D9D9);
--field-border: light-dark(#595959, #B3B3B3);
}
}
@media (forced-colors: active) {
.btn, input { border: 1px solid CanvasText; }
}
Forced colors mode can override backgrounds, text, borders, and more, so test real components in a Windows contrast theme. Leave the system’s color adjustment on for most elements. Switch it off with forced-color-adjust: none only on a specific element that needs its own colors, such as a color swatch, and check the result.
Tailwind CSS follows the same pattern: v4 uses @custom-variant dark, and v3 uses darkMode: ‘class’. A footer or code block that should stay dark in every theme can set color-scheme: dark on its own element.
Apps use platform tools for the same job:
| Platform | Theme mechanism |
|---|---|
| Web | CSS tokens with light-dark(), prefers-color-scheme, and a saved Light / Dark / System choice |
| iOS and iPadOS | Semantic system colors such as systemBackground, color sets with light and dark values in the asset catalog, and colorScheme in SwiftUI |
| Android | A Material theme with light and dark variants, and isSystemInDarkTheme() in Jetpack Compose |
| Flutter | theme, darkTheme, and themeMode on MaterialApp |
How Do You Test Dark Mode and Adaptive Themes?
Run this checklist before release:
| Check | How |
|---|---|
| Both themes render | Chrome DevTools, Rendering tab, emulate prefers-color-scheme |
| Contrast passes | Test every text and component pair in each theme with a contrast checker |
| Focus is visible | Press Tab through the page in each theme |
| Increased contrast works | Emulate prefers-contrast in DevTools |
| Forced colors work | Emulate forced-colors: active or switch on a Windows contrast theme |
| Page loads cleanly | Reload with the dark choice saved and watch for a white flash |
| Assets look right | Review every image, logo, and QR code in both themes |
| Real devices match | Check at least one OLED phone and one LCD laptop |
Larger teams can add automated screenshot comparison between themes to catch regressions after each release.
Conclusion
A theme is finished when every color pair passes contrast in every mode and every component state has its own color. Most dark mode problems come from skipped checks, such as an accent that passed on white and failed on charcoal, a focus ring that vanished on a dark card, or a logo that arrived with a white box around it.
Run the testing checklist before each release, record the contrast results next to your token values, and give people a saved Light, Dark, or System choice. If your website only looks right in one theme, talk to FTI Tech’s team about auditing your light and dark themes and building the fixes into a consistent, accessible design.






