The short version
- Good dark mode design uses dark grey rather than pure black for main surfaces, which softens contrast and leaves room to show depth.
- In dark interfaces, elevation is shown by lightness: surfaces closer to the viewer are slightly lighter, because shadows barely show on dark backgrounds.
- Text on dark backgrounds reads more comfortably in off-white than in pure white, with secondary text still above 4.5:1 contrast.
- Saturated accent colours that work on white often look too heavy on dark, so dark themes use lighter, softer tints of the same hues.
- Gradients glow on dark grounds but band easily there, so dark gradients benefit from a faint layer of grain.
On this page
Dark mode design means building a separate set of values for surfaces, text, accents and imagery, not flipping light mode's colours. Dark grounds change how colour behaves: saturated hues look heavier, shadows disappear, bright white text glares, and smooth gradients band. The good news is that the same properties make dark themes beautiful when handled well: colour glows, depth feels layered, and the content sits calmly in front.
Why to avoid pure black backgrounds
Pure black, #000000, with pure white text gives the maximum possible contrast of 21:1. That sounds ideal but is often uncomfortable: many readers see bright text bloom or vibrate against pure black, especially in long passages. Black also leaves nowhere darker to go, so you cannot show one surface sitting below another. And on some OLED phones, content scrolling over true black can leave a brief smear as pixels switch on. Google's Material Design guidance uses #121212 as its base dark surface for these reasons.
Showing elevation with lightness
In light mode, shadows separate a card from the page. On a dark background, a dark shadow barely shows. So dark themes flip the logic: the closer a surface is to the viewer, the lighter it is. The page is darkest, cards are a step lighter, menus and dialogs lighter again. Keep the steps small and consistent, and add a hairline border in a slightly lighter tone where two similar surfaces meet.
| Layer | Colour | Extra separation |
|---|---|---|
| Page background | #0e0f12 | None |
| Main surface | #121417 | None |
| Cards | #22262c | 1px border rgb(255 255 255 / 0.06) |
| Menus and popovers | #2b3038 | Border, plus a soft dark shadow |
| Dialogs | #2b3038 | A dimmed scrim over everything below |
Text colour and contrast in dark mode
Use an off-white such as #e6e8ec for body text instead of pure white. It still gives very high contrast, 15:1 on #121417, and it glares less. Secondary text can drop to a mid grey, but check it: #9aa1ad stays at 7.1:1 on the same surface and 5.5:1 on a lighter card. WCAG asks for at least 4.5:1 for normal text, whatever the theme; colour contrast explains how to check it.
Desaturating accent colours
A strong violet like #7c3aed works as a button on white. On a dark surface it looks heavy and measures only 3.2:1, too low for text links. Its lighter tint #a78bfa measures 6.8:1 on the same background and reads as the same brand colour. The general rule: move accents lighter and slightly less saturated for dark themes, and keep the hue.
Light-mode accent on dark
- Violet
#7c3aed: 3.2:1 on#121417 - Blue
#2563eb: 3.6:1 on#121417 - Heavy, vibrating edges on large areas
- Fails as link text
Dark-mode tint of the same hue
- Violet
#a78bfa: 6.8:1 on#121417 - Blue
#93c5fd: 10.2:1 on#121417 - Soft, luminous, clearly on brand
- Passes as link text
Gradients in dark mode design
Dark grounds are where gradients shine. A deep background lets colour look like light rather than paint, which is why glows, auroras and neon blends are so often shown on near-black. Keep most of the surface dark and let colour appear in one or two places: a glow behind a hero, a gradient edge on a featured card, a soft wash at the top of a page.
The catch is banding. Dark, slow fades use only a few distinct shades on an 8-bit screen, so steps become visible. A faint grain layer hides them; see gradient banding and, for the web, CSS noise texture. For backgrounds built entirely in the dark, dark gradient backgrounds has palettes.
Building dark mode in CSS
Define colours once as custom properties and switch their values per theme. color-scheme tells the browser to render its own controls and scrollbars in the matching theme, and the light-dark() function picks between two values based on the active scheme.
:root {
color-scheme: light dark;
--surface: light-dark(#ffffff, #121417);
--card: light-dark(#f6f7f9, #22262c);
--text: light-dark(#16181d, #e6e8ec);
--text-muted: light-dark(#5b6270, #9aa1ad);
--accent: light-dark(#7c3aed, #a78bfa);
}
body {
background: var(--surface);
color: var(--text);
}
@media (prefers-color-scheme: dark) {
img:not([src$=".svg"]) {
filter: brightness(0.9);
}
}Give people a manual switch as well as following the system setting, and remember everything beyond the interface: charts, illustrations, logos and email all need checking in both themes. Gradients in email covers how mail apps handle dark mode.
A dark mode checklist
- Dark grey surfaces, not pure black, with a clear lightness step per elevation.
- Off-white body text at high contrast; secondary text still above 4.5:1.
- Accents moved lighter and softer, keeping the brand hue.
- Borders, not shadows, to separate similar surfaces.
- Colour used as light in a few places, not everywhere.
- Grain on large dark gradients to prevent banding.
- Logos with a light version for dark grounds; see logo on a gradient background.
- Both themes reviewed on a real phone, in a dim room and in daylight.
Questions people ask
Should dark mode use pure black?
Usually not for main surfaces. Dark grey, such as #121212 or similar, reduces glare, leaves room for lighter raised surfaces and avoids smearing on some OLED screens.
What text colour is best for dark mode?
An off-white such as #e6e8ec rather than pure white. It still gives very high contrast while glaring less.
How do you show depth in dark mode?
Make surfaces lighter as they get closer to the viewer, and use subtle borders between similar surfaces, because shadows barely show on dark backgrounds.
Why do my brand colours look wrong in dark mode?
Saturated colours chosen for white backgrounds look heavy on dark and may fail contrast. Use lighter, softer tints of the same hues.
Do gradients work in dark mode?
Very well: colour glows on dark grounds. Use them in a few places, end them on the surface colour, and add faint grain to stop banding.
Written by Gradiently
The team behind Gradiently, a design tool built around Marks: living gradients that make everything you design look like yours.
See our profile


