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.
--backgroundThe page
--surfaceCards, dialogs and controls
--foregroundMain text
--mutedSecondary text
--borderLines and outlines
--accentLinks and main actions
--on-accentText on the accent
--goodPositive results
--criticalErrors
Shared shape
Other tokens are optional and listed on each component’s page. These are shared:
| Token | Default | Sets |
|---|---|---|
--font-display | inherited | Typeface of card, dialog and state titles |
--heading-tracking | normal | Letter spacing of those titles |
--radius-control | 0.5rem | Corner 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
.portfolioinglobals.css,.dashboardand.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);
}