Dark mode used to be a developer-tool novelty. Now it's a standard setting on every major operating system, and many people keep it on all the time. Apps without it feel dated, and websites that flash bright white at night stand out for the wrong reasons.

Doing dark mode well is harder than inverting colours. Here's how to get it right.

Why people use dark mode

  • Comfort in low light.
  • Less glare and eye strain for some people.
  • Battery savings on OLED screens.
  • Personal preference and aesthetics.

Some people, including many with astigmatism, find light text on dark backgrounds harder to read. That's why dark mode should be an option that follows the user's setting, not forced on everyone.

Colour: don't just invert

Use dark grey, not pure black

A base like #121212 or a dark tinted grey works better than #000000 for most interfaces. It reduces harsh contrast with text and lets you show depth.

Show elevation with lighter surfaces

In light mode, shadows show depth. In dark mode, shadows barely show. Instead, raised surfaces (cards, menus, dialogs) get slightly lighter.

SurfaceExample colour
Background#121212
Card#1E1E1E
Raised menu or dialog#2A2A2A

Soften text

Pure white text on dark grey can glare. Use off-white for body text (around 87% opacity white or a light grey), dimmer for secondary text, and keep enough contrast.

Desaturate brand colours

Bright, saturated colours vibrate on dark backgrounds. Use lighter, slightly less saturated versions of your brand colours for dark mode, and check they still feel like your brand. See colour psychology in branding.

Contrast and accessibility

  • Body text needs at least 4.5:1 contrast with its background; large text at least 3:1 (WCAG AA).
  • Check every state: hover, focus, disabled, error, selected.
  • Focus outlines must stay visible.
  • Don't rely on colour alone for meaning.

Test with our colour contrast checker and follow our WCAG 2.2 checklist.

Images, logos and illustrations

  • Logos: prepare a version for dark backgrounds. A dark logo on a dark header disappears. Read logo file formats explained.
  • Transparent PNGs with dark edges look broken on dark backgrounds; check them all.
  • Photos: slightly reducing brightness can stop them glaring.
  • Illustrations and icons: use colours that work on both themes, or provide variants.
  • Charts: check colours and gridlines in both modes.

Build it with design tokens

The cleanest approach is to name colours by purpose, not appearance:

TokenLightDark
--bg#FFFFFF#121212
--surface#F5F5F5#1E1E1E
--text#111111#EDEDED
--text-muted#555555#A0A0A0
--accent#E8402A#FF6B57
--border#E2E2E2#2E2E2E

Your components use the tokens, and the theme swaps the values. This is a core part of a good design system.

Code: follow the system, offer a choice

:root { --bg: #ffffff; --text: #111111; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #121212; --text: #ededed; }
}
body { background: var(--bg); color: var(--text); }

Also:

  • Set color-scheme: light dark so form controls and scrollbars match.
  • If you offer a toggle, store the choice and apply it before the page paints to avoid a white flash.
  • Use a smooth transition (or a view transition) for theme switches, while respecting reduced motion.

Common dark mode mistakes

  • Pure black backgrounds with pure white text.
  • Brand colours that glow uncomfortably.
  • Invisible logos and icons.
  • Shadows used for depth that disappear.
  • Forgetting emails, PDFs, embeds and third-party widgets.
  • A white flash when the page loads.
  • Text on images or translucent glass panels that fails contrast. See Liquid Glass and glassmorphism.

A dark mode QA checklist

Before shipping, walk through every key screen in dark mode and check:

  1. Body text contrast passes 4.5:1; large text and icons pass 3:1.
  2. Links are distinguishable from body text.
  3. Buttons, inputs and checkboxes have visible borders or fills.
  4. Focus outlines are clearly visible.
  5. Error, success and warning colours are readable and still distinct.
  6. Logos, icons and illustrations are visible and not boxed in white.
  7. Photos aren't uncomfortably bright.
  8. Charts, tables and dividers remain readable.
  9. Modals, menus and tooltips sit visibly above the background.
  10. Third-party widgets (chat, reviews, payment forms, maps) don't flash white.
  11. There's no white flash on page load or navigation.
  12. Printing and PDF exports still use light styles.
  13. Emails render acceptably in dark-mode email apps.

A worked token example

PurposeLightDarkContrast note
Page background#FFFFFF#121212Base surface
Card#F6F6F6#1C1C1ELighter surface shows elevation in dark
Primary text#111111#EDEDEDBoth well above 4.5:1
Secondary text#5A5A5A#A3A3A3Check against card colour too
Brand accent#E8402A#FF6B57Lighter, softer red for dark backgrounds
Divider#E4E4E4#2C2C2ESubtle in both

Check every pair with our colour contrast checker; the dark brand accent in particular often needs a couple of adjustments before it passes on both backgrounds.

Should you add dark mode?

ProductPriority
Mobile appsHigh: expected on iOS and Android
SaaS and web apps used dailyHigh
Content sites read at nightMedium–high
Simple marketing sitesOptional

The short version

Dark mode should follow the user's system setting, use dark greys rather than pure black, show depth with lighter surfaces, soften text and desaturate brand colours. Check contrast in every state, prepare dark-friendly logos and images, build it with design tokens and avoid a white flash on load.

Need dark mode designed and built properly? Our UI/UX design team handles theming as part of every design system.