Why it is more than inversion
Flipping every color rarely works. Brand colors may vibrate on dark backgrounds. Shadows lose meaning. Imagery with white backgrounds glows. Treat dark mode as a design in its own right.
Use semantic tokens
Define roles like background, surface, text, border, and action. Map each to a light and a dark value. Components reference roles only, so switching themes needs no component changes.
| Token | Light | Dark |
|---|---|---|
| color.background | Off-white | Near-black, not pure black |
| color.surface | White | A step lighter than the background |
| color.text.primary | Near-black | Off-white |
| color.border | Light grey | Dark grey |
| color.action | Brand accent | Adjusted for contrast on dark |
Create depth without shadows
In light themes, shadows show elevation. In dark themes, shadows are barely visible. Use slightly lighter surfaces for higher layers, and subtle borders to separate content.
Check contrast
WCAG sets minimum contrast ratios for text and for non-text elements like icons and input borders. Check both themes. Brand colors that pass on white often fail on dark backgrounds and need a lighter variant.
Test the awkward cases
- Charts: make sure series colors are distinguishable on both backgrounds.
- Images and logos: provide dark-friendly versions or transparent backgrounds.
- Form states: focus, error, and disabled need clear contrast.
- System preference: respect the user's operating system setting, and let them override it.



