01 / 04
Roles, not colours
A component names a role such as --text-secondary, and the Surface it sits on decides which grey that is, so each component is written once and works on light and dark.
Light surface
- --text-primaryText, primary
- --text-secondaryText, secondary
- --text-tertiaryText, tertiary
- --hairlineHairline
- --signalSignal
Dark surface
- --text-primaryText, primary
- --text-secondaryText, secondary
- --text-tertiaryText, tertiary
- --hairlineHairline
- --signalSignal
How it works
- 01Tokens live in app/globals.css as CSS custom properties. A dark Surface adds .surface-dark, which redefines all 14 roles at once.
- 02The figure ground is a token of its own. Lightning CSS folds a color-mix() down to its first colour when it minifies, which would turn every figure background solid black in the production build.
See it on the dark design showcaseapp/globals.css · components/chrome/Surface.tsx


