Last updated: November 20, 2026
Quick answer: most teams can start with 5 to 10 tokens per category and still build a useful design tokens and theming system. In Design tokens and theming — The Complete Guide, the core idea is simple: design tokens are the shared source of truth for design values, and theming is the system that swaps those values for a brand, mode, or product surface without rewriting components. If a button turns the wrong blue in dark mode, the fix is usually not “more CSS”; it is a better token model and a cleaner theme handoff. For implementation details, see the W3C Design Tokens Community Group draft and MDN’s CSS custom properties docs: W3C Design Tokens Community Group and MDN: Using CSS custom properties.
Key takeaways
- Tokens keep color, spacing, type, and motion names stable even when the values behind them change.
- Theming works best when components read semantic tokens, not raw hex codes or one-off values.
- A token layer without clear naming and fallback rules turns into a second stylesheet with nicer labels.
- Dark mode, brand skins, and product-tier themes all need different token scopes.
- The hardest part is not setting values; it is deciding which values belong in the core system and which belong in a theme.
What are design tokens, really?

Design tokens are named values such as color.brand.primary, space.4, or radius.md that store decisions your product uses again and again. The point is not the label itself; the point is that the label stays stable while the value can change across brands, modes, platforms, or seasons.
A clean token set has three jobs. First, it gives design and code the same language. Second, it keeps repeated values from drifting apart after 6 months of edits. Third, it gives theming a safe place to swap a small set of values instead of editing hundreds of components.
The key here is the difference between a raw value and a token alias — notice how #0057ff tells you nothing about intent, while color.action.primary tells you where it belongs. That is what separates a system you can scale from a file full of copies.
| Token type | Example | What it means | Correct use | Incorrect use |
|---|---|---|---|---|
| Primitive | blue.500 |
A base color or size | Store the actual palette or scale step | Use directly in components |
| Semantic | color.text.primary |
A role in the UI | Map to readable text across themes | Tie it to a single brand color name |
| Component | button.background.default |
A component-specific choice | Fine-tune one component family | Replace semantic tokens everywhere |
| Motion | duration.fast |
A timing step | Keep transitions consistent | Scatter random 120ms, 180ms, 250ms values |

The most common mistake is naming tokens by appearance only. gray-100 is fine for a palette step, but it is a poor semantic token because it says nothing about function. surface.subtle or text.secondary tells the next person how the token behaves in the interface.
The W3C CSS Custom Properties specification explains the mechanism that makes runtime theming practical in the browser, and MDN’s guide to CSS custom properties is a good companion reference: MDN: Using CSS custom properties. For color mode logic, MDN also documents prefers-color-scheme: MDN: prefers-color-scheme.
How do tokens become a theme?
A theme is a mapped set of token values that changes the look of the same product without changing its component logic. The theme may switch a few color tokens, a type ramp, border radii, shadows, or spacing, but the component names stay the same.
A useful way to picture this is in layers. The base layer holds the raw scales. The semantic layer names what the UI needs. The theme layer binds those semantic names to values for light mode, dark mode, a brand, or an accessibility setting.
The correct sequence
-
Start with raw scales. Create base values for color, type, spacing, radius, and motion.
Check: each scale has a clear step pattern, such asspace.1,space.2,space.4.
Do not: skip straight to component tokens and leave no shared base. -
Name semantic roles. Add tokens like
text.primary,surface.default, andborder.muted.
Check: each name describes use, not just color.
Do not: call everything by hue, such asblueTextandblueBorder. -
Map semantics to base values. Point semantic tokens at the raw scale or a CSS custom property.
Check: one semantic token can change without changing component code.
Do not: duplicate the same hex code in many places. -
Group by theme. Put light, dark, and brand-specific values in separate maps or files.
Check: the theme file reads like a small list of overrides, not a second design system.
Do not: clone the entire token set for every variant. -
Apply at the right scope. Set the theme at
:root, a page wrapper, or a product shell.
Check: a theme change affects the intended area only.
Do not: attach theme rules to random components one by one. -
Test contrast and fallback. Verify text, borders, and focus states in each mode.
Check: every token has a usable fallback for old browsers or partial support.
Do not: assume dark mode works because the palette looks nice in the token file.
The wrong way is to treat themes as “color skins” only, especially without review from a design-system lead or accessibility specialist. A real theme may also need different spacing density, shadow strength, or motion speed. A finance dashboard, for example, may keep the same component set but reduce motion and increase contrast in one theme, while a consumer app may swap only colors and type scale. For broader guidance, see Microsoft’s Fluent design guidance on theming and the W3C token work: Microsoft Fluent and W3C Design Tokens Community Group.
| Layer | Purpose | Example token | Changes per theme? | Changes per component? |
|---|---|---|---|---|
| Base scale | Raw building blocks | blue.500 |
Sometimes | No |
| Semantic token | UI meaning | text.primary |
Yes | No |
| Component token | Single component choice | button.bg.default |
Sometimes | Sometimes |
| Theme map | Variant binding | dark.text.primary = gray.50 |
Yes | No |
A good theme file is short enough to scan in under 2 minutes. If the override file is as long as the base file, the system has lost the point of theming and is now just duplicating state.
What belongs in a token, and what does not?

A token should hold a value that repeats across screens, products, or platforms, while one-off art direction usually should not become a system token. That line matters because a token is not a dumping ground for every design decision.
The safest rule is usually this: if a value is reused at least 2 or 3 times and carries a clear meaning, it can belong in a token set. If it exists once for a campaign banner or a temporary experiment, keep it local until it proves useful elsewhere. Teams should confirm that boundary with a design-system owner when the use case is ambiguous.
A practical split
| Should become a token | Usually should stay local |
|---|---|
| Brand colors used in many places | A single campaign banner color |
| Spacing steps repeated across layouts | A one-off illustration margin |
| Type sizes used in multiple components | A special headline treatment for one page |
| Border radii used in the product shell | A custom shape for one hero card |
| Motion timings used in shared UI | A temporary animation for a launch page |
The key here is scope — notice how the same 8px spacing step can be useful everywhere, while a 37px offset for one illustration does not belong in the system. This is what separates a maintainable token set from a pile of special cases.
A common mistake is making tokens too specific too early. button-primary-blue-hover-shadow reads like a solution, but it locks the token to one component and one state. A better move is to split the concern into color.action.primary, shadow.elevation.2, and state rules inside the component.
Another mistake is making tokens too generic. color1, color2, and spacing3 do not help design review, code review, or future maintenance. Those names carry no role, no intent, and no hint about when to use them.
The trade-off is simple. More semantic names give clearer code, but too many tokens can create overhead. Fewer tokens are easier to manage at first, but they invite hard-coded values later. The right level is the one that makes the next 10 changes easier, not the next one.
How do you build a token system step by step?
You build a token system by defining scales, naming roles, mapping themes, and exporting the result into the formats your product uses. The process is part design decision, part naming discipline, and part file structure.
The correct build order
-
Inventory the repeated values. List the colors, sizes, radii, shadows, and motion values already in the product.
Check: you can point to at least 3 repeated values in each major category.
Do not: start with empty theory and no existing UI. -
Separate primitives from semantics. Keep raw scales apart from role-based tokens.
Check: a developer can tell the difference in 10 seconds.
Do not: mixblue.500andtext.primaryin the same flat bucket. -
Set naming rules. Pick one syntax for hierarchy, such as
category.role.state.
Check: names are predictable and sortable.
Do not: switch between camelCase, kebab-case, and freeform labels in one set. -
Create theme overlays. Define how light, dark, and brand variants override semantic tokens.
Check: each overlay changes only what it must.
Do not: clone the whole token library for a new theme. -
Export to platform formats. Send values to CSS variables, JSON, native code, or a design tool format.
Check: the same token name resolves consistently in each target.
Do not: hand-enter values into each platform separately. -
Document usage rules. Explain which tokens are safe for components and which are not.
Check: examples show correct and incorrect token choice.
Do not: leave the token file as a mystery box. -
Review on a 2-week rhythm. Revisit new tokens after real product changes land.
Check: unused tokens are removed or merged.
Do not: let the system grow for months without cleanup.
This is where teams often overcomplicate the file structure. A token system does not need 12 folders on day one. It needs a structure that makes a designer and a developer choose the same value without a meeting.
A simple file pattern
| File or layer | Contains | Example |
|---|---|---|
core |
Raw scales | blue.500, space.4, radius.2 |
semantic |
UI meaning | surface.default, text.primary |
theme.light |
Light overrides | text.primary = gray.900 |
theme.dark |
Dark overrides | text.primary = gray.50 |
component |
Rare component-specific values | button.shadow.focus |
That pattern keeps the system readable. It also makes refactors less painful because the team can move values between layers without renaming everything at once.
What does good theming look like in the UI?
Good theming makes the same interface feel different without making it behave differently, and the differences are easy to spot at a glance. The button still sits in the same place, but its text color, surface color, border, shadow, and focus ring adapt to the theme.
The easiest visual test is to compare a light theme and a dark theme side by side. The button label should remain readable in both. The surface should not glare in light mode or disappear into the background in dark mode. Focus states should still be obvious.
Before vs. after
| UI element | Weak implementation | Strong implementation |
|---|---|---|
| Primary button | Hard-coded blue in the component | Reads from button.bg.primary or color.action.primary |
| Page background | One fixed white value | Theme-controlled surface.canvas |
| Text | Random gray values per component | One semantic text scale |
| Border | Mixed grays with no pattern | Shared border token set |
| Focus ring | Hidden or inconsistent | One defined focus token across controls |
The key here is the focus ring — notice how it is a named system value, not a one-off outline glued onto a single control. That is what separates a theme that holds together under keyboard use from one that only looks right in a screenshot.
A good theme also respects density. A compact enterprise screen may need tighter spacing and smaller type than a consumer onboarding flow. That does not mean creating a second visual identity; it means swapping a few spacing and type tokens while keeping the component logic intact.
A bad theme shows its flaws in the small things first. Form labels lose contrast. Disabled states become unreadable. Card shadows grow so soft in dark mode that the cards blend into the page. These are not styling nits; they are signs that the token map is missing semantic intent.
If the interface changes look but not hierarchy, the theme is probably working. If the entire layout shifts when the theme changes, the system has tied theme values to layout too tightly.
How do you handle dark mode, brands, and product variants?
You handle dark mode, brands, and product variants with the same token architecture, but each one changes a different slice of the map. Dark mode is mostly about contrast and surface depth. A brand theme is mostly about identity color and type treatment. A product variant may change density, motion, or emphasis rules.
That distinction matters because not every theme should change everything. A dark theme that also rewrites spacing and typography can feel like a different product. A brand theme that changes only logo color may feel too shallow for real multi-brand use.
Compare the theme types
| Theme type | What usually changes | What should stay stable | Main risk |
|---|---|---|---|
| Dark mode | Surfaces, text, borders, shadows | Layout and component names | Low contrast or glare |
| Brand theme | Accent colors, logo area, some type tokens | Interaction patterns | Brand color overload |
| Density variant | Spacing, sizing, sometimes type | Semantic meaning | Crowded or airy UI |
| Accessibility theme | Contrast, motion, focus visibility | Product structure | Overcorrecting and harming hierarchy |
The correct rule is to theme the difference, not the whole product. If two brands share the same checkout flow, the system should keep the same checkout.summary logic and swap only the tokens that make the brand feel distinct.
What to check in each variant
-
Contrast: text and icons remain legible in the states you ship, as guidance from WCAG and MDN suggests.
Check: body copy does not fade against the canvas.
Do not: rely on color alone to show state. -
Hierarchy: headings, labels, and actions still feel ordered.
Check: primary actions remain visually stronger than secondary ones.
Do not: let brand color flatten every element into the same weight. -
State clarity: hover, focus, active, disabled, and error states still differ.
Check: each state has one obvious visual cue.
Do not: make states so subtle that only a designer can see them. -
Scope: the theme changes only what users should notice.
Check: the page does not jump or resize in unexpected ways.
Do not: bind theme values to layout math unless that is the point.
Dark mode often fails because people invert colors without rethinking surfaces. Pure inversion can make shadows vanish and make borders noisy. A better dark theme usually uses a darker canvas, lifted surfaces, and carefully tuned text and border tokens rather than a simple negative image of light mode. For contrast guidance, see WCAG 2.2 and MDN’s color-scheme documentation: W3C WCAG 2.2 and MDN: prefers-color-scheme.
Where do teams get this wrong?
Teams get theming wrong when they treat tokens as a naming exercise instead of a decision system. The result is usually a pile of values that looks organized but still allows drift, duplication, and one-off fixes.
The most common failure is skipping semantic tokens. When components read raw palette values directly, a theme swap becomes expensive because every component has to know every color change. Another failure is over-tokenizing too early, which creates 100 names for details that should have been 12.
The failure modes
| Problem | What it looks like | Why it hurts | Better fix |
|---|---|---|---|
| Raw values in components | Hex codes inside UI files | Theme changes need broad edits | Move to semantic tokens |
| Too many near-duplicates | gray.700, gray.720, gray.730 |
No one knows which to use | Reduce the scale or define roles |
| Theme tied to component code | ButtonDarkBlue variants everywhere |
Hard to add a new theme | Keep theme mapping outside components |
| No naming rule | Mixed syntax and ad hoc labels | Search and review get messy | Use one pattern across the system |
| No fallback plan | Tokens break in older targets | Inconsistent rendering | Define default values and fallback paths |
The key here is the naming rule — notice how the same color can be reasonable in a palette but harmful in a semantic slot if nobody can tell what it means. That is what separates a system that grows from one that rots.
There is also a social failure mode. If designers, developers, and product teams do not agree on token boundaries, the system becomes either too rigid or too loose. Too rigid means every change needs a process ticket. Too loose means everyone creates local overrides and the token library stops mattering.
One honest limitation: design tokens do not solve taste disagreements. They make values easier to move and compare, but they do not decide whether the product should be playful, clinical, dense, or roomy. That still needs product direction, not just better files.
How should a team maintain tokens over time?
A team should maintain tokens with the same discipline it uses for code: review, prune, and change names carefully. A token system that is not maintained becomes more confusing than no system at all.
The first maintenance habit is to review tokens after real UI changes, not on a vague schedule with no output. The second is to retire duplicates when two tokens now mean the same thing. The third is to protect the semantic layer, because that is the part most likely to outlive a redesign.
A maintenance checklist
-
Audit every 2 weeks or after a release.
Check: new tokens have a real use.
Do not: let random additions stay forever. -
Search for duplicates.
Check: near-identical values are merged or renamed.
Do not: keepgray.300andgray.310for no clear reason. -
Mark deprecated tokens.
Check: old names still work during migration.
Do not: delete names before consumers have moved. -
Keep a change log.
Check: teams can see what changed and why.
Do not: rename tokens silently. -
Validate output in each target.
Check: CSS, design tool, and code output match.
Do not: assume one export path covers all platforms. -
Review accessibility impact.
Check: contrast and state cues remain usable after edits.
Do not: treat accessibility as a final polish step.
A token set can survive a lot if the naming is honest and the mapping is stable. It fails fast when people use it as a shortcut around design thinking. The system is supposed to reduce repetition, not erase judgment.
The best reason to keep tokens and theming disciplined is simple: it makes change cheaper. A product can refresh a brand, add dark mode, or split into variants without rewriting its whole interface. That is the real value of the system.
Can you start small and still do this well?
Yes, you can start with 5 to 10 tokens per category and still build a useful system. The trick is to begin with the tokens that repeat the most: a small color scale, a type scale, spacing steps, and a few semantic roles.
A small start is often better than a perfect one. A token system that covers only color at first can still pay off if the team names it well and keeps the semantics clean. Trying to model every possible theme on day one usually slows the project more than it helps it.
The limit is important, though, because a small start should still grow into a full design tokens and theming system. If the system only covers a couple of colors and never expands to spacing, type, border, and motion, it stays a branding layer, not a theming layer. A real theme needs enough coverage to shape the whole interface, not just the logo button.
A small-start roadmap
| Phase | What to add first | What to leave for later |
|---|---|---|
| Phase 1 | Core colors and text roles | Complex motion and component variants |
| Phase 2 | Spacing and radius scales | Rare one-off marketing tokens |
| Phase 3 | Dark mode mapping | Multi-brand edge cases |
| Phase 4 | Density or platform variants | Experimental or seasonal overrides |
The key here is the road map — notice how each phase adds one more layer of control, not a hundred new names. That is what separates an approachable system from one that scares off the team that has to maintain it.
A small, honest system is better than a grand one that nobody touches. Start with the 20 values that already shape most of the interface, define the semantic layer carefully, and keep the theme rules short enough to review in one sitting. That path is slower at the start and much faster after the first redesign.
What should you remember before you build one?
You should remember that design tokens are the naming system and theming is the mapping system. Tokens tell the product what a value means; themes tell the product which value to use in a given context.
If you get that split right, the rest becomes easier to reason about. If you blur the split, every theme change turns into component surgery.
FAQ
Are design tokens the same as CSS variables?
No, design tokens are not the same as CSS variables, but CSS variables are one common way to deliver them in the browser. A token is the design concept and naming layer; a CSS variable is one implementation target. A team can store tokens in JSON, design tools, or code and still map them to CSS custom properties later.
Do I need semantic tokens if I already have a color palette?
Yes, if you want theming to stay manageable. A palette gives you raw colors like blue.500, but semantic tokens like text.primary and surface.default tell components what those colors mean. Without that layer, a dark mode or brand swap usually requires far more edits.
How many themes should a system support?
Only the themes the product truly needs should be supported. Many systems start with light and dark, then add one brand or density variant if the product requires it. More themes are not better unless each one solves a real user or business need.
What is the biggest mistake teams make with tokens?
The biggest mistake is putting raw values directly into components and calling that a system. That approach looks simple at first, but it makes theme changes expensive and inconsistent. A second common mistake is creating too many near-duplicate tokens before the naming rules are settled.
Can a small team use design tokens successfully?
Yes, a small team can use them very well if the system stays small and clear. Start with the values that repeat most often, define a simple naming rule, and keep the theme map short. A compact token set is often easier for a small team to keep healthy than a large one.
Drafted with AI; not yet reviewed by a person.
