Design Tokens: What Actually Works
Follow an illustrative rebrand and dark-mode project to see how design tokens are audited, named, tiered, themed, versioned and shipped from one source.
On this page
- The Illustrative Brief: A Rebrand and Dark Mode on a Drifted Product
- Project Timeline From Kickoff to Launch
- Auditing Values Before Naming a Single Design Token
- Choosing Three Tiers: Primitives, Semantic Aliases and Component Tokens
- Naming Design Tokens by Role: The Vocabulary the Team Agreed On
- Theming by Redefining Tokens, Not Rewriting Components
- Building a Single Source Consumed by Both Design and Code
- Migrating Components Without Stopping Product Work
- Designing the New Brand as Token Values
- Versioning Tokens and Communicating Breaking Changes
- Launch Day: Landing the Rebrand as a Token Change
- What We Would Keep, What We Would Change, and When to Bring In Help
- Working on something like this?
Design tokens are named values for design decisions: the colors, spacing steps, type sizes, corner radii and animation durations that a product uses, stored once and shared between design tools and code. A button's background is not "#1F5FD6" in one place and "a slightly different blue" in another. It is action-primary, and both the design file and the shipped interface read the same value from the same source.
That shared source is what makes a design system enforceable rather than aspirational. Without tokens, a system is a set of good intentions in a Figma library and a separate set of hard-coded values in a codebase, and the two drift a little with every release. With tokens, a rebrand or a new theme becomes a change to a few dozen values instead of a hunt through hundreds of components. That matters to product owners who are about to commission a rebrand, to marketing teams who need the product to match the new brand on launch day, and to the designers and front-end engineers who will actually do the work.
Rather than list principles in the abstract, this guide follows one project from brief to delivery and explains each decision as it was made. The project is illustrative: a composite built from the kinds of engagements a studio like ours sees, not a real client, and every number in it is an example chosen to make the arithmetic concrete. The decisions, the traps and the reasoning are the parts to take away.
The Illustrative Brief: A Rebrand and Dark Mode on a Drifted Product
The fictional client is a business software company with a web application of moderate size: a customer dashboard, a settings area, a billing flow, an onboarding sequence and a set of admin tools. Roughly 60 screens, built over five years by a changing cast of designers and engineers. They had a component library in React and a Figma library that was supposed to mirror it. In practice, the two had grown apart.
The brief arrived with three goals stated in the client's own order of priority:
- Apply a new brand, with a new primary color, a new typeface and a softer shape language, across the entire product by a fixed launch date roughly four months away, timed to a marketing campaign.
- Add a dark theme, which customers had requested for years and which had been declined twice because "it would mean touching every component."
- Stop the drift. The head of product wanted a system in which a designer's decision in Figma and an engineer's implementation could not quietly diverge.
The third goal is the one that makes the first two affordable. A rebrand applied by hand to a drifted codebase is a one-time effort that starts decaying the day after launch. A rebrand applied through tokens is a change to shared values, and the dark theme becomes a second set of those same values. So the project was framed from the first meeting as a design tokens project that happens to deliver a rebrand and a theme, not the other way round.
Decision: Scope the work as token infrastructure first, visual change second. The client initially wanted designers to start on new brand screens in week one. We argued, and they agreed, that new screens drawn on top of the old values would simply create a third source of truth. The visual rebrand work began only once the token structure existed to receive it.
This is also where the team structure was set. The core group was one design systems designer, one front-end engineer who owned the component library, and a part-time product designer from the client who knew the product's history. If you are commissioning this kind of work from an outside team, our guide to working with external design teams covers how to split ownership so the system is yours when the engagement ends.
Project Timeline From Kickoff to Launch
The schedule below is the plan as it was agreed at kickoff, with the adjustments that happened along the way folded in. The shape is more useful than the exact dates: audit before naming, structure before visuals, migration in parallel with product work, and a freeze before launch.
- Weeks 1–2 Audit every color, spacing, type and radius value in both the Figma library and the codebase; map where they diverge.
- Weeks 3–4 Define the three token tiers and the naming vocabulary; review with design, engineering and product leads.
- Weeks 5–6 Build the token source, the build pipeline and the Figma variable collections; publish version 1.0 with the old brand values.
- Weeks 7–11 Migrate components to semantic tokens in batches, alongside normal product work; no visual change yet.
- Weeks 12–13 Design the new brand and dark theme as token values; test contrast and review key screens in both themes.
- Weeks 14–15 Ship the new values behind a flag, run internal dogfooding, fix the remaining hard-coded values.
- Week 16 Freeze, release the new token version, and switch the flag on launch day.
The detail that surprised the client most was week six: version 1.0 of the tokens shipped with the old brand. Nothing on screen changed. That was deliberate. If the migration to tokens and the change of values happen at the same time, every visual difference is ambiguous: is this a migration bug or an intended brand change? Separating the two means that during migration, any visible change is by definition a bug, which makes review fast and unambiguous.
Auditing Values Before Naming a Single Design Token
The first two weeks produced no tokens at all. They produced an inventory. The temptation on token projects is to open a spreadsheet and start naming things, but naming before you know what exists produces a vocabulary shaped by guesses.
What the audit collected
The engineer wrote a small script to extract every literal color value, pixel value and font declaration from the stylesheets and component files, with a count of how often each appeared. The designer did the equivalent in Figma, listing every local style, every detached color and every one-off value found in the library and in the most-used product files. Both lists went into one shared spreadsheet with columns for the value, where it appears, how many times, and what it seems to be doing.
That last column is the important one. A value's job, not its appearance, is what the eventual token will be named after. "#6B7280 appears 212 times" is trivia. "#6B7280 is used for secondary text, placeholder text and disabled icons" is a finding: it tells you the same gray is doing three jobs that may need to diverge in a dark theme.
What the illustrative audit found
These numbers are invented for the example, but the pattern is typical of a product of this age. Most of the 41 grays were near-duplicates: someone picked a gray by eye, someone else picked a slightly different one. The 23 spacing values included sensible steps (4, 8, 12, 16, 24, 32) and a long tail of odd values (6, 10, 14, 18, 22, 28) produced by nudging layouts until they looked right. The 14 radii came from three redesigns layered on top of each other.
The audit then answered a simpler question for each cluster: which of these values are the same decision expressed inconsistently, and which are genuinely different decisions? Two grays one step apart used for the same job are the same decision. A gray used for body text and a gray used for dividers are different decisions, even if they happen to be the same hex value today.
Trap avoided: Making a token for every value in the audit. The first draft of the spreadsheet proposed 41 gray tokens, one per value found, "to be safe." That would have codified the drift instead of ending it. The rule adopted instead: a value earns a token only if it represents a decision someone would deliberately reuse.
- Near-duplicates were merged into the nearest intended value.
- Genuine one-offs stayed as local exceptions and were flagged for design review.
- Anything nobody could explain was treated as a bug, not a requirement.
Choosing Three Tiers: Primitives, Semantic Aliases and Component Tokens
With the inventory done, weeks three and four settled the structure. The team adopted three tiers, which is the model most mature systems converge on. Material Design's documentation on design tokens describes a comparable layering of reference, system and component tokens, and the reasoning carries over whatever names you use.
| Tier | What it holds | Example name | Who references it |
|---|---|---|---|
| Primitive | The raw palette and scales: every available color, spacing step and type size | color.blue.600, space.4 | Only the semantic tier |
| Semantic | The role a value plays anywhere in the product | color.text.muted, color.action.primary | Components and layouts |
| Component | A role specific to one component, where it needs to vary independently | button.primary.background | That component only |
Why the primitive tier stays small and hidden
The primitive palette is the set of ingredients. In the illustrative project, it ended with 10 steps each for a neutral scale and the brand color, shorter scales for success, warning, danger and information hues, eight spacing steps and seven type sizes. Components never touch these directly. The reason is theming: color.blue.600 is the same blue in light and dark themes, so any component that uses it directly will not change when the theme does. Only the semantic layer knows which primitive to use in which context.
Keeping the primitive set small matters for a separate reason. Every primitive is an option a designer can reach for. Ten well-spaced neutrals is a palette; forty is an invitation to repeat the drift the audit uncovered.
Why the component tier is used sparingly
The team debated whether to create component tokens for everything, so that a button would have tokens for its background, text, border, radius, padding and focus ring in every state. They decided against it. A component token earns its place only when that component needs to diverge from the semantic role it would otherwise use. The primary button's background is color.action.primary; it only gets its own token if there is a real reason the button should differ from other primary actions, such as a marketing requirement that the checkout button be distinct. In this project, that left component tokens for a handful of components with genuinely unusual needs: data visualization series, the status badge set and the navigation sidebar, which had a distinct surface treatment.
Decision: Three tiers, with the component tier opt-in. Every component token had to be justified in the pull request that created it with one sentence: what would go wrong if this component used the semantic token instead? If nobody could answer, the component token was not created.
Naming Design Tokens by Role: The Vocabulary the Team Agreed On
Naming consumed more meeting time than any other part of the project, and it should. The names are the interface that every designer and engineer will use daily for years. The central rule is the one that distinguishes working token systems from decorative ones: name by role, not by appearance.
Role names versus appearance names
An appearance name describes what a value looks like: blue-500, gray-light, big-spacing. A role name describes what it is for: surface, text-muted, action-primary, border-subtle, space-inset-md. Appearance names seem easier because they are concrete, but they break the moment the appearance changes. After the rebrand, the primary action color would no longer be blue. A component that says blue-500 is now lying, and fixing it means editing the component. A component that says action-primary is still correct; only the value behind the name changed.
Appearance names do have a home: the primitive tier. color.blue.600 is the right name for a primitive, because a primitive is a specific color and nothing more. The semantic tier is where role names live.
The structure of a name
The team settled on a consistent pattern for semantic tokens: category, then role, then variant, then state where needed. Some examples from the final vocabulary:
- color.surface.default, color.surface.raised, color.surface.sunken for backgrounds at different elevations.
- color.text.default, color.text.muted, color.text.inverse, color.text.on-action for foregrounds.
- color.action.primary, color.action.primary-hover, color.action.primary-pressed for interactive elements.
- color.border.subtle, color.border.strong, color.border.focus for edges and the focus ring.
- color.feedback.danger, color.feedback.danger-surface for error states and their backgrounds.
- space.inset.sm/md/lg for padding and space.stack.sm/md/lg for vertical rhythm between elements.
Testing the vocabulary before committing to it
Before adopting the names, the team ran a short exercise: five people who had not been in the naming meetings were given ten screenshots and asked which token each highlighted element should use. Where people disagreed, the name was ambiguous. That exercise killed two proposed names. color.text.secondary was read by some as "less important text" and by others as "text in the secondary brand color," so it became color.text.muted. color.background.alt meant nothing in particular to anyone and was replaced by the elevation-based surface names. A quick session like this is a small version of the structured exercises covered in our guide to facilitating design workshops.
The team also wrote a short naming guide, one page long, that stated the pattern and listed the approved roles. Writing it down turned out to have the same benefits as writing design principles: it settled arguments by reference rather than by seniority.
Theming by Redefining Tokens, Not Rewriting Components
With three tiers and role-based names in place, the dark theme stopped being a component problem. A theme is simply a second mapping from semantic tokens to primitives. The component asks for color.surface.default; in the light theme that resolves to near-white, in the dark theme to a dark neutral. No component contains an "if dark mode" branch.
A worked example: one card in two themes
Take a simple content card: a raised surface, a heading, muted body text, a subtle border and a primary action link. In the illustrative token source, the relevant semantic tokens mapped like this:
| Semantic token | Light theme primitive | Dark theme primitive | Contrast target |
|---|---|---|---|
| color.surface.raised | neutral.0 (white) | neutral.850 | Background |
| color.text.default | neutral.900 | neutral.50 | At least 4.5:1 on surface |
| color.text.muted | neutral.600 | neutral.300 | At least 4.5:1 on surface |
| color.border.subtle | neutral.200 | neutral.700 | Decorative only |
| color.action.primary | brand.600 | brand.300 | At least 4.5:1 as link text |
Notice that the dark theme does not simply invert the scale. The raised surface in dark mode is lighter than the base dark surface, because in dark interfaces elevation is usually conveyed by lightness rather than by shadow, which barely shows on dark backgrounds. And the action color shifts from a darker brand step to a lighter one, because the darker step that passes contrast on white fails on a dark surface. These are design decisions, and the token structure is where they get recorded once instead of being re-decided in every component.
The contrast column is not decoration. Every text-on-surface pairing was checked against WCAG thresholds: 4.5:1 for normal text and 3:1 for large text and for the visible boundaries of interactive components. Because tokens pair predictably, the team could check a finite list of pairings rather than every screen. Our guide to accessibility in design goes deeper on what to test and when.
Where the theme broke, and why
The first dark-theme build exposed every place a component had bypassed the semantic tier. An illustrated empty state had a white background baked into the SVG. A chart library had its own default colors. Three modals used a hard-coded shadow color. None of these were token problems; they were places where tokens had not yet reached. The theme acted as a very effective audit, which is one reason to build the second theme early rather than at the end.
Trap avoided: Overriding components per theme. Midway through, an engineer proposed fixing the modal shadow with a dark-mode-specific CSS override on the modal component. It would have worked, and it would have been the first of many. The rule held: if a component looks wrong in a theme, either it is using the wrong semantic token or a semantic token is missing. Fix the mapping, not the component. The modal got a color.shadow.overlay token, and the overrides never started.
Modals were a recurring source of theme bugs because they combine a scrim, a raised surface, focus handling and often nested components. If your product leans heavily on them, the patterns in our guide to modal dialog design are worth reviewing alongside the token work.
Building a Single Source Consumed by Both Design and Code
Weeks five and six built the plumbing. The requirement was simple to state and easy to get wrong: there must be exactly one place where a token's value is defined, and both the design tool and the codebase must read from it.
The source format
The illustrative team stored tokens as JSON files in their own repository, one file per tier and one file per theme for the semantic mappings. They followed the structure of the Design Tokens Community Group draft format, with a value and a type for each token, because it is increasingly supported by tools and avoids inventing a private schema. A semantic token's value is a reference to a primitive, not a literal, so the relationship between tiers is explicit in the data.
The code side
A build step, using Style Dictionary, transformed the JSON into the outputs the product needed: CSS custom properties for the web app, with theme switching handled by scoping the semantic variables under a theme attribute on the root element, and a TypeScript module exporting token names so that a misspelled token fails at build time rather than silently falling back. The output was published as a versioned internal package. The component library depended on that package like any other dependency.
The design side
In Figma, primitives and semantic tokens became variables in separate collections, with the semantic collection using modes for light and dark. Figma's help center documentation on variables covers how collections, modes and aliasing work; the key point is that a semantic variable can alias a primitive variable, which mirrors the tiers in code. The team used a token plugin to sync the JSON into Figma variables, so a change merged into the token repository flowed into the Figma library rather than being retyped by hand.
The repository, not Figma, is the source of truth. Both directions were considered. Figma-as-source is attractive to designers, but the repository gives review, history, versioning and automated checks for free. Designers propose changes through a lightweight request, and the design systems designer merges them. Designers still work in Figma every day; they just do not edit variable values there directly.
Automated checks that paid for themselves
- A check that every semantic token resolves to an existing primitive in every theme, so a missing dark-mode mapping fails the build.
- A contrast check over the declared text-on-surface pairings in each theme.
- A lint rule in the component library that flags literal hex values and pixel values in style files, with an allowlist for justified exceptions.
- A generated documentation page listing every token, its value per theme and a swatch, rebuilt on every release.
The lint rule did more to stop drift than any amount of documentation. Once a hard-coded color fails review automatically, nobody has to be the person who objects to it.
Migrating Components Without Stopping Product Work
Weeks seven to eleven were the longest stretch and the least glamorous. The component library and the product screens had to be moved from literal values to semantic tokens while the product team continued shipping features. Freezing product development for five weeks was never an option.
How the migration was sequenced
- Foundations first Global styles, typography, the page shell and layout spacing moved first, because every other component sits inside them.
- High-reuse components next Buttons, inputs, links, cards and badges, since fixing one of these fixes it on every screen at once.
- Composite components Modals, tables, navigation, forms and the date picker, which combine many primitives and expose missing roles.
- Screen-level leftovers One-off styles inside product screens, found by the lint rule and cleaned up by the teams that owned those screens.
- Third-party surfaces Charts, the rich text editor and embedded widgets, configured to read token values through their theming options.
Each batch was a set of small pull requests, reviewed with before-and-after screenshots. Because version 1.0 of the tokens held the old brand values, every screenshot pair should have been pixel-identical or nearly so. Differences were bugs, usually a component mapped to the wrong role. That made review quick enough that migration pull requests rarely waited more than a day.
Handling the values that did not fit
Roughly speaking, most of the values in the codebase mapped cleanly to a semantic role. The remainder fell into three groups. Near-duplicates, such as a gray one step off from text.muted, were snapped to the token, accepting a barely visible change. Genuinely new roles, like the sidebar's distinct surface, became new semantic or component tokens after a short review. And true one-offs, such as a marketing banner with a campaign color, stayed as documented exceptions with a comment explaining why.
The product teams were brought into the migration rather than having it done to them. Each team owned the cleanup of its own screens in the fourth step, which spread the work and taught the vocabulary to the people who would use it. Our guide to design system contribution models covers the governance options for this kind of shared ownership in more depth.
Designing the New Brand as Token Values
Only in weeks twelve and thirteen did the visual rebrand begin in earnest, and by then it was a different kind of task. The brand designers were not redrawing 60 screens. They were choosing new primitive values and new semantic mappings, then reviewing a set of representative screens that rendered those values automatically.
What changed in the token source
- Brand primitives: a new 10-step brand scale built around the new primary color, with steps chosen so that the steps used for action colors met contrast in both themes.
- Typography: the font family token changed, and the type scale was retuned because the new typeface had a larger x-height, which made the old sizes read slightly large.
- Radius: the three semantic radius tokens (small, medium, large) moved to softer values to match the new shape language. The 14 radii found in the audit had already been collapsed into these three during migration, so this was a three-value change.
- Semantic remapping: a few roles pointed to different primitives, for instance the focus ring moved from the brand scale to a dedicated high-visibility color so it would not disappear against brand-colored buttons.
Reviewing the brand across representative screens
The team picked twelve screens that together exercised every semantic token: the dashboard, a dense data table, a long form, the billing flow, an error state, an empty state, the sign-in page and a few others. Each was reviewed in both themes. The dashboard deserved special attention because data-heavy interfaces stress color roles more than any other screen; the chart series and status colors needed their own tuning, a topic we cover in our guide to dashboard and data interface design.
Executive sign-off happened at this stage, and it went faster than usual because the review was about a small number of decisions presented as a system rather than about dozens of screens with individual pixel preferences. The team presented the palette, the semantic mapping, the contrast results and the twelve screens, and asked for approval of the values, not the screens. The approach is covered in more detail in our guide to design reviews with executives.
Versioning Tokens and Communicating Breaking Changes
Tokens are an API. Components, product screens, marketing pages and, in this case, a separate help-center site all consumed the package. Changing what a token means without warning breaks those consumers in ways that are hard to trace, because nothing fails to compile; things just look subtly wrong.
The versioning rules the team adopted
The token package followed semantic versioning with token-specific definitions of each level:
- Patch
- A value adjusted within its role, such as a gray nudged slightly for contrast. Consumers need to do nothing.
- Minor
- A new token added, or a new theme. Existing usage is unaffected.
- Major
- A token removed or renamed, or a token's role changed, such as a border token now intended for focus states. Consumers must review their usage.
The rebrand itself was released as a major version, not because names changed but because several values changed meaning enough that consumers outside the core product, especially the help center and marketing pages, needed to check their usage. Every release came with a changelog written for people, not generated from commits: what changed, why, and what a consumer needs to do. Renamed tokens stayed available as deprecated aliases for one major version, and the lint rule warned on deprecated names so teams could migrate at their own pace.
One late request illustrates why this matters. Late in the project, someone proposed repointing color.border.strong to the brand color "because it looks nicer on the new cards." It would have looked nicer on cards and wrong on every form input that used the same token for its resting border. The change became a new component token for cards, released as a minor version, and border.strong kept its meaning.
The GOV.UK Design System's guidance on styles is a useful reference for this discipline: it publishes shared color, spacing and typography values and asks services to use them rather than reinvent them, which is the same contract a versioned token package makes with its consumers.
Launch Day: Landing the Rebrand as a Token Change
Weeks fourteen and fifteen shipped the new token version to production behind a feature flag. Internally, staff saw the new brand and could opt into the dark theme; customers saw the old brand. Two weeks of dogfooding caught the last hard-coded values, mostly in rarely visited admin screens and transactional email templates that had not been in the original audit scope.
Week sixteen was a freeze on token changes. On launch day, the flag switched, and the product changed brand in a single deployment that touched no component code. The dark theme went live the same day as a user preference in settings, defaulting to the operating system setting. The marketing campaign launched against a product that already matched it.
The illustrative before-and-after, in numbers
To make the effect concrete, here is the arithmetic from the example. Before the project, the audit counted 41 grays, 23 spacing values and 14 radii spread across both sides. After it, the primitive tier held a 10-step neutral scale, 8 spacing steps and 3 radius values, fronted by roughly 60 semantic tokens and a dozen component tokens. The rebrand itself, the part that would traditionally mean weeks of editing components, came down to changing about 30 primitive values and a handful of semantic mappings, reviewed in one pull request. Adding a third theme later, such as a high-contrast mode, would mean writing one more semantic mapping file and running the same contrast checks.
Again, these numbers belong to an illustrative project. Your counts will differ, and what drives them is the age of the product, how many people have designed for it, and whether any value discipline existed before. The ratio is what tends to hold: a large, messy set of literal values collapses into a small primitive set and a moderate semantic layer.
What We Would Keep, What We Would Change, and When to Bring In Help
Looking back across the project, a few choices did most of the work.
Worth keeping
- Separating migration from visual change. Shipping tokens with the old values first made every review objective and let product work continue without confusion.
- Building the second theme early. The dark theme found every bypass of the semantic tier far faster than any code review would have.
- Automating enforcement. The lint rule and the build-time checks kept the system honest after the project team moved on.
- A small, readable vocabulary. Around sixty semantic tokens is a number people can learn; several hundred is not.
Worth changing next time
- Audit email templates and PDFs from the start. They consume brand values too, and they were found late.
- Define motion tokens alongside color and space. Durations and easing curves were left as literals and drifted again within months.
- Involve content and accessibility review earlier. Contrast was checked systematically, but focus visibility and reduced-motion preferences deserved the same treatment from week three, in line with the practices in our guide to inclusive design.
When a team should bring in outside help
Many teams can build a token system themselves, particularly on a newer product with one design team and one codebase. Outside help tends to earn its cost in three situations: when a rebrand must land across an entire product on a fixed date, when design and code have drifted so far apart that nobody internally can say which values are correct, and when theming has to be added to a system that was never built for it. In each case, the hard part is not the tooling. It is the audit, the naming decisions and the discipline to migrate without mixing in visual change, all of which benefit from people who have done it before and have no attachment to the existing values. If that describes your situation, our UI and UX design services include design systems work of exactly this kind.
The bottom line: design tokens work when they are named by role, organized in a small primitive tier behind a semantic layer, redefined per theme rather than overridden per component, distributed from a single versioned source to both design and code, and enforced by automated checks. Get those five things right, and a rebrand or a new theme stops being a project and becomes a release.
Where this comes from
- Figma Help Center — Variables and tokens
- Material Design — Design tokens
- GOV.UK Design System — Styles and consistency
The figures and practices above come from the sources listed.
Working on something like this?
We take on UI & UX Design work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.
Where to go next
Spotted something wrong? Report an error on this page. We correct on the page and say what changed.