Ask a team whether they use design tokens and most will say yes. Ask to see them and you usually find a file of colours with new names: blue-500, grey-100, brand-primary. That is a palette, and a palette does not stop anyone from putting light grey text on a white card. A token system earns its keep when it works like a contract between design and code. Here is how we set them up.
Three layers, one rule
We split tokens into three layers:
Primitives: the raw values. Every colour in every scale, the spacing steps, the type sizes. Nobody uses these directly.
Semantic tokens: what a value means.
surface,text,text-muted,accent,danger,focus. Themes and brands are defined here, by pointing each semantic token at a primitive.Component tokens: decisions particular to one component, such as
button-backgroundorinput-border, which point at semantic tokens.
The rule: a component may only use semantic or component tokens. Never a primitive, never a hex value. That one rule is what makes a dark mode, a second brand or a contrast fix a change in one place.
Names describe a job, not a look
accent survives a rebrand from blue to lime; blue does not. Every semantic token is named after the job it does on the screen. When a designer cannot find a token for a job, that is a signal: either the job is new and deserves a token, or the design is drifting from the system and deserves a conversation.
The contract is enforced by machines
A contract nobody checks is a suggestion. In every system we build:
Figma is the source. Tokens live as Figma variables, with each brand or theme as a mode, so designers change the system where they work.
Code is generated. A pipeline reads the variables, writes the CSS custom properties and Tailwind theme, and opens a pull request with the diff.
CI checks the pairs. Every text and surface pair is tested for WCAG contrast in every theme. A failing pair blocks the merge, in the designer's change as well as the engineer's.
Lint rules ban raw values. A hex code in a component file fails the build.
What it buys you
On the Volt AI project, four product brands share one component library. A brand-wide colour change takes one publish in Figma and one merge, about twenty minutes from decision to production in every product. Their fifth product had its brand defined in two days.
The palette was never the hard part. The hard part is agreeing what each value is for, writing that agreement down where both designers and engineers work, and letting machines hold everyone to it.