Theming
Rebrand the system for a client by editing app/globals.css alone, choosing the layer that gives the outcome you want.
The whole Silkware theme lives in one file, app/globals.css. A client brand is produced by editing that file and nothing else: no component changes, no class changes, no wrappers. This page shows which layer to edit for which outcome, how to add a token, a worked example that was run against the real contrast checker, and the theme editor that writes the file for you.
Units per delivery.
Units per delivery.
The panel on the right is the same card with five token values replaced on its wrapper: the radius, the primary colour, the focus ring, the brand colour and the error colour. Nothing else differs. That is how far a token reaches.
The layers, and which one to edit
globals.css has three layers. Colour lists every token in them.
| You want | Edit | Where | Example |
|---|---|---|---|
| A different brand colour everywhere | Layer 1, brand primitives | :root | --crimson, --crimson-pale, --crimson-deep, --crimson-light |
| New greys and a new black | Layer 1 | :root | --ink, --fog, --seal |
| The primary button in the brand colour, not ink | Layer 2, semantic tokens | :root for light, .dark for dark | --primary: var(--crimson-deep) |
| Errors in a real red | Layer 2 | both modes | --destructive |
| Different status colours | Layer 1 for the hue, layer 2 for the role | both modes | --pine, --amber, --cobalt and their -light steps, read by --success, --warning, --info |
| Control borders | Layer 2 | both modes | --input-edge for the border of a field, --input for its fill |
| Code colours | Layer 2 | both modes | --syntax-token-keyword, --syntax-token-string and the rest of the --syntax- set |
| The size of a touch target | :root | --touch-target, used inside a touch-controls scope only | |
| A different typeface | Layer 1, :root | --typeface-mona, --font-text, --font-title | |
| Softer or squarer corners | :root | --radius | |
| Thicker or thinner icons | :root | --icon-stroke, --arrow-stroke | |
| Line heights and tracking of the type scale | :root | --leading-xs to --leading-6xl, --tracking-xl to --tracking-6xl | |
| Heading, control and text weights | :root | --weight-heading, --weight-control, --weight-text | |
| The editorial steps of a landing page | :root | --step-display, --step-statement, --step-lead and their --leading-* and --tracking-* | |
| The reading rhythm of rendered text | :root | --typeset-docs-size, --typeset-docs-leading, --typeset-docs-flow, and the --typeset-chat- and --typeset-compact- pairs | |
| Looser or tighter layout | :root | --pad-x, --gutter, --section-pad, --stack-gap | |
| Shadows | :root | --elevation-panel-light, --elevation-panel-dark | |
| A new utility | Layer 3 | @theme inline | --color-highlight: var(--highlight) |
Start from the top. A change to layer 1 moves every semantic token that points at it. A change to layer 2 moves one role. Layer 3 maps names to utilities, and you edit it only to add a name.
The sizes of the standard steps are Tailwind's own and live in @theme inline; a rebrand changes their line heights and tracking, not their names. The Typeset presets read their values from :root as well, and the theme editor lists them under Rendered text. See Typography and Typeset.
Two rules hold throughout. Keep both modes: every semantic colour needs a light value and a dark value. And do not edit a file in components/ui: if an outcome needs one, it cannot be reached by a theme and is a recorded gap (see Principles).
A worked example
A fictional client, Ternmoor Engineering, wants a deep teal in place of crimson, softer corners and a humanist sans. Every step below was done in the theme editor, starting from the Silkware theme, in this order. After each one the editor's header reports the number of changes and the contrast result, and those numbers are quoted here. The outcome is close to the Ternmoor Engineering preset but not the same file: the editor derives the tints from the accent, and the preset was set by hand.
Choose the accent
On the Brand step, under Accent, choose Teal (
#0f766e). The editor writes the four crimson primitives, which keep their names because layer 2 points at them. The deeper and lighter tints are derived so they hold contrast.- --crimson: #d81f5c;- --crimson-pale: #f9d7e2;- --crimson-deep: #b8184e;- --crimson-light: #ff99b4;+ --crimson: #0f766e;+ --crimson-pale: #c9e0de;+ --crimson-deep: #0f736c;+ --crimson-light: #75b0ac;The header now reads 4 changes and 2 contrast failures, both on destructive buttons.
--destructiveis defined asvar(--crimson-deep)in light andvar(--crimson-light)in dark, so errors are now teal as well. Brand and error were one colour in Silkware.Split the error colour
On the Tokens step, find
--destructiveand give it a red of its own in each mode. With Light values selected, set it to#b42318; with Dark values selected, to#fda29b. The dark value must be light enough for small text on ink.- --destructive: var(--crimson-deep);+ --destructive: #b42318;- --destructive: var(--crimson-light);+ --destructive: #fda29b;The first is in the light block, the second in the
.darkblock. The header reads 6 changes and contrast passes.Choose what the primary button is
Silkware's primary button is ink. Under Primary actions on the Brand step, choose Accent. The editor points the primary and the sidebar's primary at the deep teal in light and at the light teal in dark.
The header now reads 10 changes and 1 contrast failure: the hover state of the primary button, teal at 80% under white text, is 3.82:1. Open the Contrast step and press the one-press fix, Set primary to
#0e625c. The pair passes at 4.5:1 and the header reads contrast passes.- --primary: var(--ink);+ --primary: #0e625c;- --sidebar-primary: var(--ink);+ --sidebar-primary: var(--crimson-deep);In dark mode
--primarybecomesvar(--crimson-light).Tint the greys
Under Neutrals, choose From the accent. Eleven grey primitives, from
--inkto--smoke, move a little towards teal, so surfaces, borders and notes sit quietly beside the accent. Ink changes from#0a0a0ato#040c0b. Contrast still passes at 21 changes.Set the typeface and the corners
Under Typeface, choose Humanist sans for running text and again for headings. Under Corners, choose Soft.
- --font-text: var(--typeface-mona);- --font-title: var(--typeface-mona);+ --font-text: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;+ --font-title: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;- --radius: 0.5rem;+ --radius: 0.875rem;--radiusmoves every step of the scale together, because each step is a fraction of it. For a web font that the visitor does not have installed, add an@font-facerule beside the two that load Mona Sans and Noto Sans SC, and put the file underpublic/fonts/.Look at it, then check it
Use the scenes above the preview (Dashboard, Form, Table, Agent, Type), switch between Light, Dark and Both, and between Desktop and Phone. Press Show original to compare with the shipped theme: your edits are kept. The Contrast step reads "All 229 checks pass", the same checks as
pnpm check:contrast, which readsapp/globals.css, resolves everyvar()and exits with an error on any pair under 4.5:1 for text or 3:1 for rings, edges and marks.The finished theme has 24 changes. The Hand over step lists each one, and the file it exports is the complete
globals.css.
When a change fails
A value that looks fine can still fail. In the editor, set the light --muted-foreground to var(--ash), a lighter grey, and the header reports 1 change and 7 contrast failures: 2.36:1 for muted text on a secondary surface and 2.57:1 for notes, card descriptions and menu shortcuts, against 4.5:1 needed. The Contrast step names each pair and offers the nearest value that passes, #6e6e71. Take it, or choose a darker grey yourself. Fix the value, not the check.
On a dark ground, a dark brand colour can pass as a square and fail as text. In the worked example the teal on the dark ink is 3.61:1, which passes the 3:1 for marks, but teal text on ink would not pass 4.5:1. Where the brand colour is used as text in dark mode, point --brand at a lighter step in the .dark block, as the Veltrane Instruments preset does.
Add a token
When a client needs a role the system does not have, such as a highlight for notes, add it in three places, in this order.
:root,.light,[data-theme="light"] { --highlight: #fef3c7; --highlight-foreground: var(--ink);}.dark,[data-theme="dark"] { --highlight: #422006; --highlight-foreground: var(--white);}@theme inline { --color-highlight: var(--highlight); --color-highlight-foreground: var(--highlight-foreground);}With the three blocks in place, bg-highlight and text-highlight-foreground exist as utilities: Tailwind generated .bg-highlight { background-color: var(--highlight); } from the edited file, and the unedited file generates no such class. Without the @theme inline lines, the variable exists and no utility does.
Declare the pair in both modes, name a foreground for every fill, and add the pair to contrastPairs in lib/theme/tokens.ts if you want the checker to cover it. That file is shared with the theme editor and is outside a rebrand, so ask the maintainers to add it.
The theme editor
You do not have to edit the file by hand. The theme editor at /themes has four steps beside a large preview, and it exports a complete globals.css.
- Brand. Start from Silkware, Ternmoor Engineering or Veltrane Instruments, or import a
globals.css. Then make the brand decisions: the accent (the tints are derived), whether primary actions are ink or the accent, the neutrals, the typeface for text and for headings, the heading weight (500, 600 or 700), the heading tracking (tight, or none for a serif or a wide face) and the corners. Each decision lists the tokens it writes. The Tokens step lists the line heights, tracking and weights under Type scale and Typefaces and weights. - Tokens. Every declaration in the file, found by name, label or value, for light or dark values, filtered to All, Changed or Failing. Edit a value, follow a
var()to the token it reads, reset one token to the file value, or press Show where to see where it lands in the preview. - Contrast. Every pair the system checks, 229 in all, with the failures first. Each failure names the pair, its ratio and the minimum, and offers the nearest value that passes as a one-press fix, or opens the token for you to edit.
- Hand over. The list of changes, the contrast result, and the file: Download globals.css or Copy file. A switch applies your theme to the whole documentation site in this browser.
The preview has five scenes (Dashboard, Form, Table, Agent and Type), shows light, dark or both, at desktop or phone width. Show original compares with the shipped values without losing your edits. Undo and redo step through every change, also with Control or Command and Z. On a narrow screen an Edit and Preview switch replaces the side-by-side layout. Your edits are kept in this browser, so you can leave and return.
The export is the shipped file with only the edited declarations replaced: the line count and the order are the same, so it diffs cleanly. With no edits, the export is the shipped file byte for byte. pnpm check:theme verifies this, together with the round trip through import and the contrast of all three presets.