30

Dark Mode and Adaptive Color

Dark mode looks like a switch, but it is really a second design. Flip the colors mechanically and brand hues go wrong, grays turn harsh, and text starts to glow and vibrate. A good dark theme is a deliberately built palette - softened surfaces, lightened accents, contrast that still passes - mapped through the same set of tokens as the light one. This is the interactive guide to doing it on purpose.

Design · 31 5 Live Demos ~35 min read Theming
2
Themes, one token set
≠ invert
Dark mode is designed
#121212
Dark base, not pure black
WCAG
Still applies both ways
01

Why dark mode is not invert

The tempting shortcut is to invert every color - swap light for dark and call it done. It fails immediately. Inversion turns your blue brand color orange, flips carefully chosen grays into jarring near-blacks, wrecks photos and logos, and inverts shadows into glows. Lightness should flip; hue and identity should not. A real dark theme keeps the brand, re-picks neutrals for a dark context, and adapts accents - it is a separate palette, not a filter.

Interactive 01 · Three themes

Light, designed dark, and naive invert

The same interface in three treatments. Light is the source. Designed dark keeps the blue accent and uses softened neutrals. Naive invert flips every channel - watch the accent swing to the wrong hue and the surfaces turn harsh. Same layout; only the color strategy differs.

◆ Northwind Home · Docs · Pricing

Your dashboard

PRO Details →
 
02

One system, two themes

The way to keep two themes sane is semantic tokens: name colors by their role, not their value. Instead of --blue-600 sprinkled through the UI, you reference --color-surface, --color-text, --color-accent. Each theme then provides its own values for those roles. The components never change; only the token map does. This is the single most important structural decision for theming.

Background / surface
The base canvas and the cards on it. In dark mode, surfaces get lighter as they rise, not darker.
Text / on-surface
Foreground text and icons, defined as "on" a given surface so contrast is guaranteed per role.
Accent / brand
The action color. Keeps its hue identity but adapts lightness and chroma per theme.
State colors
Success, warning, error - each needs a light and a dark variant that both pass contrast and read as the same meaning.
03

Surfaces and elevation

In light mode, raised elements feel closer because of shadows. In dark mode, shadows barely show against a dark background, so depth is signaled the opposite way: higher surfaces get lighter. Material's approach overlays increasing amounts of white as elevation rises - a dialog sits on a lighter gray than the card beneath it. Lighter means closer.

Interactive 02 · Elevation

Raise a surface by lightening it

On a #121212 base, drag the elevation. Higher elevation adds a stronger white overlay, lifting the surface toward the viewer without any shadow. The cards show a few elevation steps at once; the readout gives the resulting surface color.

#1e1e1e
04

Avoid pure black and white

Pure white text on a pure black field is the maximum 21:1 contrast - and it is uncomfortable. The extreme edge causes halation: the bright text seems to smear or vibrate, worst on OLED screens and for readers with astigmatism. The fix is to pull both ends in: a dark gray base (around #121212) and an off-white text (around #E0-#E6). You keep strong, readable contrast while losing the glare - and you gain headroom for elevation, which a pure-black base does not have.

Interactive 03 · Soften the extremes

Pure vs softened, with live contrast

The left panel is pure #000 / #FFF; the right is softened by the amount you choose. Both show their WCAG contrast ratio. Notice the softened panel still passes AAA comfortably while feeling calmer - more contrast is not automatically more readable.

Pure

#000 background, #FFF text. Maximum contrast - and maximum halation on bright text.

Contrast 21.0:1
Softened

Dark-gray base, off-white text. Strong but comfortable, with room for elevation.

Contrast 16.1:1
05

Accents must adapt

An accent tuned for a white background is usually a darker, more saturated color so it has contrast against light. Drop that same color onto a dark surface and two things go wrong: its contrast often fails, and a highly saturated hue on dark can visually vibrate. The dark-mode accent is normally a lighter, slightly less saturated version of the same hue - same identity, re-tuned for its new background.

Interactive 04 · Adaptive accent

The same hue, re-tuned for dark

Pick a brand accent. The left card uses it on a light surface; the right uses it unchanged on a dark surface - often failing contrast. The auto-adapted swatch lightens (and gently desaturates) the same hue until it passes against the dark surface. Both contrast ratios are live.

#6ea0ff
On light surface · #FFFFFF Learn more → contrast —
On dark surface · #161616 raw — · adapted —
06

Contrast still applies

Dark mode does not relax accessibility - WCAG contrast ratios apply exactly the same in both themes, and a palette that passes in light can fail in dark (and vice versa). Every text-on-surface and accent-on-surface pair must clear the same thresholds: 4.5:1 for normal text, 3:1 for large text and UI components. Because dark surfaces lighten with elevation, the contrast of a fixed text color drifts as the surface beneath it rises - so check text against each surface level, not just the base.

Test both themes, every pair. "It passes in light mode" says nothing about dark. Run the full text-on-surface and accent-on-surface matrix in each theme, at the elevations you actually use. The earlier accent demo is exactly this check, automated for one color.
07

Advanced adaptive theme lab

A production dark theme is not a single background and foreground pair. It is a matrix of base surfaces, elevated surfaces, text roles, accent states, media treatment, and contrast checks. This lab combines those pieces into a live token engine so you can see how one change ripples through the system.

Interactive 05 · Adaptive theme engine

Generate a dark-mode token set and audit it live

Pick a base surface and brand accent, then tune elevation, text softness, accent lift, chroma reduction, media dimming, and state intensity. The canvas previews the interface and the side panel exports the token values, contrast ratios, and risk signals.

Token export

Waiting for token map...

Accessibility audit

Waiting for audit...

Body text
0%
Accent text
0%
Media glare
0%
State signal
0%

Design note

Keep hue identity stable, then adapt lightness and chroma per surface.
08

Theming in code

Implementation follows the token idea directly. Define semantic custom properties once, give them light values by default, and override them in a dark block - keyed off the user's system preference and/or an explicit toggle. Components only ever read the tokens.

:root {
  --color-surface: #ffffff;
  --color-text: #1a1a1a;
  --color-accent: #2563eb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --color-surface: #121212;
    --color-text: #e6e6e6;
    --color-accent: #6ea0ff; /* lighter, re-tuned */
  }
} Add a [data-theme="dark"] override too, so a manual toggle can beat the system setting. Components reference only var(--color-...).

Generating the dark token values is exactly the kind of lightness/chroma re-tuning the Auric Artisan Shade and Palette tools automate - they can emit paired light/dark token sets in OKLCH that already pass contrast, so the two themes stay in lockstep.

09

Pitfalls and gotchas

Inverting everything
Flipping channels wrecks hue, neutrals, images, and shadows. Design a second palette through tokens instead.
Pure black base
#000 causes halation and leaves no room for elevation. Start around #121212.
Reusing the light accent
A dark, saturated accent often fails contrast and vibrates on dark. Lighten and slightly desaturate it.
Shadows for depth
Shadows vanish on dark. Convey elevation with lighter surfaces instead.
Skipping the contrast re-check
Passing in light says nothing about dark. Re-run every pair per theme and per elevation.
Full-strength images
Bright photos and white-background logos glare on dark. Dim media slightly or provide dark-mode assets.
10

Test your understanding

Six questions on inversion, surfaces, softened extremes, and adaptive accents. Instant feedback, no scores recorded - a wrong answer comes with a short explanation.

Quick check

Loading…
 
Question 1 of 6
11

Continue your journey

Adaptive theming leans on contrast, perceptual lightness, and theory. The numbers reflect each article's position in the editorial roadmap.