Designing Dark Mode Colors That Work

· 4 min read

Why inverting a light theme fails, how to pick dark backgrounds and text, tone down saturated colors and show depth without shadows.

Dark mode looks simple: make the background dark and the text light. In practice, a dark theme built by flipping the light one usually feels harsh, flat or oddly neon. The colors that worked on white behave differently on black. This guide covers the decisions that make a dark theme comfortable to use.

Why inverting doesn't work

Inverting swaps lightness, but people do not perceive light and dark symmetrically. A few things go wrong at once:

  • Contrast becomes extreme. Pure white text on pure black is 21:1 — far more than needed — and bright text can seem to bleed into the background, especially for people with astigmatism.
  • Saturated colors glow. A vivid blue that looked solid on white seems to vibrate on a dark background.
  • Depth disappears. Shadows, which separate layers in a light theme, are nearly invisible on dark surfaces.
  • Mid-tone brand colors lose contrast. A color dark enough for white text in the light theme is often too dark to read on a dark background.

Choose a dark gray, not black

Most well-made dark themes use a very dark gray, often with a slight tint, rather than #000000. Material Design, for example, recommends #121212 as the base surface. A dark gray keeps contrast high while softening the edge between text and background, and it leaves room to show elevation with lighter surfaces.

#000000#121212#14161F#1A1612

Pure black, neutral dark gray, a cool tint and a warm tint. Tinting the background with the palette's main hue ties the dark theme to the brand, just as an off-white does in a light theme.

Pure black does have one use: on OLED screens it switches pixels off and saves power. Some apps offer it as a separate "true black" option. As a default, a dark gray is easier on the eyes.

Soften the text

White text on #121212 has a ratio of 18.73:1. An off-white such as #E6E6E6 still gives 15.01:1 — well above the 7:1 AAA target — and is noticeably more comfortable to read. Secondary text can drop further, but keep it at 4.5:1 or above.

A common pattern is to express text levels as opacity over the background: around 87% for primary text, 60% for secondary text and 38% for disabled text. Whether you use opacity or fixed colors, measure the final result, not the intention.

Tone down saturated colors

Bright, saturated colors that work on white need to be lighter and less saturated on dark. Besides looking calmer, this is often required for contrast:

Color on #121212RatioResult
#3D5AFE (vivid blue)3.65:1Fails for text
#8C9EFF (lighter, softer blue)7.54:1Passes AAA
#6200EE (deep purple)2.46:1Fails even for icons
#BB86FC (light purple)7.07:1Passes AAA

The same brand can, and usually should, use a different shade of its primary color in each theme. Keep the hue fixed and move lightness and chroma. Viewers will still recognize the brand, because hue carries most of the identity.

Show depth with lighter surfaces

In a light theme, a card is separated from the page by a shadow. In a dark theme, the natural cue is the opposite: surfaces that are closer to the viewer are slightly lighter. A typical stack might be:

  • Page background: the darkest value.
  • Cards and panels: a few percent lighter.
  • Menus, dialogs and popovers: lighter again.

Thin borders help too. A border a little lighter than the surface gives crisp edges where shadows would be lost.

Check everything again

A dark theme is a second design, so it needs its own contrast pass:

  • Button labels: a light primary color may now need dark text instead of white.
  • Status colors: red, green and yellow for errors, success and warnings usually need lighter versions.
  • Charts: series colors tuned for white backgrounds may blend into a dark one.
  • Images and illustrations: graphics with white backgrounds look like glaring boxes; transparent versions or a subtle frame help.

Implementation tips

  • Follow the system setting with the prefers-color-scheme media query, and let people override it with a toggle.
  • Set the theme before the first paint (for example, a tiny inline script that reads the saved choice) to avoid a white flash on load.
  • Add color-scheme: light dark so form controls and scrollbars follow the theme.
  • Store colors as role-based variables so the switch changes values, not components. See color tokens in CSS and Tailwind.

See it on real interfaces

Every palette on Colorset comes with a dark version built this way: the background comes from the dark end of the palette, text and accent colors are adjusted until they meet contrast targets, and the result is previewed on a website, a dashboard and an app. Browse dark color palettes for schemes that start out dark, or press D on any page to switch this site's own theme.