By the end of this lesson you can
- Design dark themes that are comfortable and accessible.
- Adapt colour, elevation and imagery for dark backgrounds.
- Implement themes with semantic tokens and modes.
The idea
A dark theme uses dark surfaces with light text. People choose it for comfort in low light, personal preference or battery saving on some screens. It is not simply inverted colours.
Key principles
- Avoid pure black and pure white. Use dark greys for surfaces and slightly off-white text to reduce glare and halo effects.
- Desaturate colours. Bright saturated colours vibrate on dark backgrounds; use lighter, softer versions.
- Elevation with lightness. Shadows are hard to see on dark surfaces, so raised surfaces are usually slightly lighter.
- Check contrast again. Every text and UI colour needs re-testing in the dark theme.
- Images and illustrations may need dark versions, and logos may need light variants.
Implementation
Use semantic tokens such as surface/default and text/primary with Light and Dark modes. Components never reference raw colours, so switching theme is automatic. Respect the operating system setting by default and let people override it.
Why it matters in real projects
Many people now expect a dark theme, and some need it to reduce eye strain or light sensitivity. A poorly made dark theme, with harsh contrast, vibrating colours or invisible elevation, is worse than none. Token-based theming makes it maintainable.
A realistic example
A podcast app adds a dark theme by inverting colours. The pure white text on pure black looks harsh, the bright brand orange buzzes, cards are indistinguishable from the background and the logo disappears.
The team redesigns with a #121212-style dark grey base, lighter surfaces for raised cards, off-white text, a softer orange for actions and a light logo variant. Everything is driven by semantic tokens with two modes, and contrast is checked for every pairing.
Step by step
Set up semantic tokens
Make surface, text, border and action tokens with Light and Dark modes.
Choose surfaces
Pick a dark grey base and lighter steps for elevation.
Adjust colours
Create softer versions of brand and status colours.
Check contrast
Test every text and UI colour pair.
Handle imagery
Prepare dark-friendly illustrations and logo variants.
Test in context
Use the theme in a dark room and in daylight.
Common mistakes
Mistake Simply inverting colours.
Instead Design the dark theme deliberately.
Mistake Pure black with pure white text.
Instead Use dark grey and off-white.
Mistake Relying on shadows for elevation.
Instead Use lighter surfaces for raised elements.
Check your understanding
Choose an answer, then check it. There is an explanation either way.
Practice exercise
Exercise · about 1 h
Dark theme
Create a dark theme for one of your screens.
Steps
- Convert colours to semantic tokens with two modes.
- Design surfaces and elevation.
- Adjust brand and status colours.
- Check contrast for all pairs.
Deliverable
The screen in light and dark themes with a contrast table.
Self-assessment
Tick each item when it is true of your exercise. Be honest; this is for you.
4 items
Summary
- Dark themes are designed, not inverted.
- Use dark greys, off-white text and softer colours.
- Show elevation with lighter surfaces.
- Implement with semantic tokens and modes.
Further reading
Third-party sources, chosen for reliability. They open in a new tab.
- prefers-color-scheme (opens in a new tab)MDN Web Docs
- Colour roles (opens in a new tab)Material Design 3
Your notes
Marking complete updates your course and roadmap progress.