Design system/Foundations
Dark mode
Dark mode isn't a second version: it's the same tokens with a second value. data-theme="dark" on html, and a script before hydration reads the preference so the page never flashes light for a moment.
In codeapp/globals.cssapp/layout.tsxcomponents/theme.tsx
Live example
A piece of the interface in both themes side by side, with the same classes; only data-theme has changed.
On
SCampaign briefEdited yesterdayopen
Today3
Dark
SCampaign briefEdited yesterdayopen
Today3
What changes
- Charcoal (--dark) turns light and the text on it turns dark; in dark mode the primary button is the brightest thing on the page.
- Orange is slightly lighter (#F4571F) so it carries the same weight on a dark background.
- Soft colors (accent-soft, green-soft, red-soft) are transparent in dark mode so they sit on any surface.
- color-scheme changes too, so the scrollbar and any remaining native controls turn dark as well.
- Background, border, and text color of body, cards, fields, pills, and buttons change over 0.25 seconds, not all at once.
Do
var(--card) and var(--text).
Don't
#fff and #000; in dark mode a white rectangle stays in the middle of the page.
Do
For the logo on dark, the on-dark version.
Don't
invert on the logo image.
Related pages