Designing a dark mode that works

Intermediate  Nov 3, 2026

Avoid pure black, keep contrast and re-check every colour.

Designing a dark mode that works
The steps of this tutorial at a glance.
The steps of this tutorial at a glance.

It is not just inverting

Simply swapping black and white produces glare and poor hierarchy. Design the dark palette on purpose.

Colours

  • Use dark grey backgrounds (for example #121212 or a deep blue-grey) rather than pure black.
  • Use off-white text (#E5E7EB) instead of pure white to reduce glare.
  • Lighten or desaturate brand colours. Very saturated colours vibrate on dark backgrounds.
Colours
Colours

Depth

In light mode, shadows show depth. In dark mode, shadows are hard to see, so use slightly lighter surfaces for elements that are "higher": cards lighter than the page, dialogs lighter than cards.

Contrast

Check contrast again. The 4.5:1 text rule applies in both themes.

Contrast
Contrast

Images and icons

  • Check transparent PNG logos. A dark logo vanishes on a dark background.
  • Reduce image brightness a little if photos look too bright.

Implementation

Use design tokens so each colour has a light and a dark value, and respect the system setting:

:root { color-scheme: light dark; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #121212; --text: #e5e7eb; --card: #1e1e1e; }
}
How the code in this section fits into the page.
How the code in this section fits into the page.

Let users choose

Offer Light, Dark and System, and remember the choice.

Let users choose
Let users choose

More tutorials