Skip to content
Flat Meet

Light and dark

Foundations

How the themes work, and why UI uses tokens, never raw colours

Every colour has a dark and a light value in design-system/tokens.json (the light one in $extensions["flm.light"]). npm run tokens writes CSS that uses the dark values by default and switches to the light ones when the person picks light. The device's own preference is not followed: Flat Meet starts dark.

Switch the theme

Rules

  • Always use tokens (bg-bg-surface, text-text-primary); the colour then follows the theme by itself
  • No raw colours, even in one spot: add a token. The summary's trophy and vote count use highlight, for example
  • Video tiles stay dark in both themes, like a screen: their colours are the video component tokens, one value for both
  • The person's choice is kept in localStorage and set as data-theme on <html> before the first paint, so the page never flashes
  • tokens.test.ts checks every contrast pair in both themes, Storybook runs every story in both, and the end-to-end tests check every page again in light mode