Skip to content

Theming

Set tokens on a class that wraps a site. Pick a theme in the sidebar to compare.

Colour tokens

Every theme has these. The defaults are in src/app/globals.css, with light and dark values.

  • --background

    The page

  • --surface

    Cards, dialogs and controls

  • --foreground

    Main text

  • --muted

    Secondary text

  • --border

    Lines and outlines

  • --accent

    Links and main actions

  • --on-accent

    Text on the accent

  • --good

    Positive results

  • --critical

    Errors

Shared shape

Other tokens are optional and listed on each component’s page. These are shared:

Tokens
TokenDefaultSets
--font-displayinheritedTypeface of card, dialog and state titles
--heading-trackingnormalLetter spacing of those titles
--radius-control0.5remCorner radius of buttons, fields, dialogs, states and pill links

Making a theme

Set only what differs from the defaults:

.bakery {
  --accent: #8a4b12;
  --on-accent: #ffffff;
  --radius-control: 0.25rem;
  --card-shadow: 0 12px 28px -18px rgb(0 0 0 / 0.4);
}
<div className="bakery bg-background text-foreground">…</div>
  • Give the colours dark values in a prefers-color-scheme query.
  • The existing themes are .portfolio in globals.css, .dashboard and .restaurant, each beside its pages.

Areas with their own colours

A token such as --button-secondary-text: var(--accent) takes the value --accent has where the token is set, not where the button is. If part of a theme changes the colours, like the restaurant’s dark .band, set such tokens on both selectors:

.restaurant,
.restaurant .band {
  --button-secondary-border: var(--accent);
  --button-secondary-text: var(--accent);
}