Color tokens are the named decisions a design system makes about color: not #1a7f5a, but “the background of a primary button” or “the text on a raised surface.” Components, design files and code read the name; the value behind it can change per theme, per brand or per release without anyone editing a component.
This guide covers the parts that decide whether a color token set holds up: the tiers, the names, the file format, the CSS output, contrast pairs, dark mode and status colors. It is written for design engineers and design-system maintainers setting up color tokens or untangling a palette that grew without them.
What a color token is (and what a palette isn’t)
A palette lists the colors you have. A color token says what one of them is for. green-600 is a palette entry; color.background.brand is a decision that currently points at green-600. When the brand moves to a different green, or dark mode needs a lighter one, only the pointer changes.
The test for a good color token is whether its name stays true when its value changes. color.surface.raised is still the raised surface in dark mode. color.light-gray holding a near-black value in dark mode is a lie every consumer has to remember.
The three tiers: primitive, semantic, component
Most mature color systems separate color tokens into three tiers. Each tier references only the tier below it.
| Tier | What it holds | Example | Who reads it |
|---|---|---|---|
| Primitive | Raw values in ramps, named by hue and step | green.600 → #1a7f5a | Only the semantic tier |
| Semantic | Roles in the interface, aliased to primitives | color.background.brand → {green.600} | Components, design files, agents |
| Component | A narrow override for one component | button.primary.background → {color.background.brand} | That component only |
Theme and brand switching happen in the semantic tier: light and dark mode are two sets of semantic-to-primitive mappings over the same primitives. Keep component tokens rare. Each one is a sign that a role may be missing from the semantic vocabulary, and a component that reaches straight for green.600 has opted out of theming.
Go deeperSemantic tokens vs primitive tokens in component libraries
Building the primitive ramps
Primitives are the raw material: one ramp per hue (a neutral, the brand hue, and one each for the status colors), each with numbered steps from lightest to darkest. Two choices matter more than the exact values.
- Use a consistent step scale across every hue (for example 50, 100, 200 … 900), so
red.600andgreen.600sit at a comparable lightness and a status color can be swapped without re-checking contrast from scratch. - Name primitives by hue and step only. A primitive called
brandorerroris a semantic token in the wrong tier, and it breaks the moment the role and the hue part ways. - Generate ramps in a perceptual color space (such as OKLCH) when you can, so equal steps look like equal steps. Check that the tools you export to accept the color space you author in.
Naming semantic color tokens
Semantic names read from general to specific. A common shape is category, property, role, then emphasis or state:
color . background . brand . hover
│ │ │ └ state (optional)
│ │ └ role / emphasis
│ └ property: background, text, border, icon
└ categorySplitting by property (background, text, border, icon) matters for color more than for any other token type, because the same role needs different values on different properties: brand text on a light surface is usually darker than a brand fill. A typical starting vocabulary:
| Property | Roles to start with |
|---|---|
color.background | default, subtle, brand, brand.hover, danger, success, warning, disabled |
color.surface | base, raised, overlay, sunken |
color.text | default, subtle, disabled, inverse, brand, on-brand, danger, link |
color.border | default, subtle, strong, focus, danger |
color.icon | default, subtle, brand, on-brand |
Pick one separator and one casing and enforce them in CI. Names describe the role, never the hue: color.text.danger, not color.text.red.
Go deeperDesign token naming conventions for multi-brand systems
Writing color tokens in DTCG JSON
The W3C Design Tokens Community Group (DTCG) format is the interchange format most token tools read and write. A color token has $type: "color" and a $value; a semantic token’s value is an alias in curly braces that points at a primitive. In the 2025.10 version of the format, a literal color value is an object with a color space and components rather than a bare hex string:
{
"green": {
"$type": "color",
"600": {
"$value": {
"colorSpace": "srgb",
"components": [0.102, 0.498, 0.353],
"hex": "#1a7f5a"
}
}
},
"color": {
"$type": "color",
"background": {
"brand": {
"$value": "{green.600}",
"$description": "Fill for the primary action and brand-led surfaces."
}
},
"text": {
"on-brand": { "$value": "{neutral.0}" }
}
}
}Use $description on semantic tokens. It is the only place the intent of a role is written down next to the role, and it is what a person or an agent reads when deciding between two tokens. Before you commit to a file layout, check which version of the format your toolchain supports: the spec is at designtokens.org, and tools such as Style Dictionary document their own DTCG support level.
Shipping color tokens to CSS and Tailwind
A build step (Style Dictionary or similar) turns the JSON into platform output. On the web that is usually CSS custom properties, with primitives and the light mappings on :root and the dark mappings under a theme selector:
:root {
--green-600: #1a7f5a;
--neutral-0: #ffffff;
--neutral-900: #111814;
--color-background-brand: var(--green-600);
--color-text-on-brand: var(--neutral-0);
--color-surface-base: var(--neutral-0);
}
[data-theme="dark"] {
--color-background-brand: var(--green-400);
--color-text-on-brand: var(--neutral-900);
--color-surface-base: var(--neutral-900);
}Keep the semantic layer as var() references in the output rather than resolved hex values, so a theme selector can remap it at runtime. In Tailwind v4, variables declared in the --color-* namespace inside @theme become utilities, so pointing them at your semantic variables gives you bg-brand and text-on-brand classes that follow the active theme:
@import "tailwindcss";
@theme inline {
--color-brand: var(--color-background-brand);
--color-on-brand: var(--color-text-on-brand);
--color-surface: var(--color-surface-base);
}Expose only semantic tokens as utilities. If bg-green-600 is available, it will be used, and every use is a component that won’t follow a theme.
Go deeperExporting Figma variables to production token pipelines
Contrast: tokenize the pairs, not just the colors
Contrast is a property of two colors together, so a color system stays accessible only if it knows which foreground goes on which background. That is what “on” tokens are for: every fill role gets a matching text or icon role (color.background.brand with color.text.on-brand), the same idea as Material Design’s primary and on-primary roles.
- Write the intended pairs down as data (a list of foreground/background token pairs) and test every pair in every theme in CI, not just the default one.
- WCAG 2.x asks for at least 4.5:1 for normal text and 3:1 for large text (success criterion 1.4.3), and 3:1 for meaningful non-text UI such as input borders, focus rings and icons (1.4.11). Check the current criteria on w3.org before you encode them as thresholds.
- Avoid semi-transparent text tokens over arbitrary surfaces. Their contrast depends on whatever sits underneath, so they can’t be tested once and trusted.
Dark mode and status colors
Dark mode is a second set of semantic mappings, not a second palette and not an inversion. A few color-specific rules make it work:
- Use dark grays rather than pure black for the base surface, and make raised surfaces lighter than the base so elevation still reads.
- Re-pick brand and interactive colors for dark backgrounds. A saturated brand color that passes contrast on white often needs a lighter step on a dark surface, which is why
color.background.brandmaps to a different primitive per theme. - Keep the meaning of status colors fixed across themes and brands.
color.text.dangercan change its step between light and dark, but it should never be remapped to a brand hue by a theme. - Every semantic color token needs a value in every theme, or an explicit note that it is theme-independent. Make a missing mapping fail the build.
Go deeperDark mode token architecture without duplicate palettes
Color tokens across several brands
Brands are themes along another axis. Each brand supplies its own primitives and its own semantic mappings, while components keep reading the same semantic names. A brand selector such as [data-brand="b"] does the same job as the dark-theme selector. The setup breaks when a brand forks the whole token file or adds component-level color overrides, because then the semantic contract is no longer the only thing a brand changes.
Go deeperTheming multiple brands from a single component library
Color tokens and AI coding agents
Coding agents generating UI do what a new team member does with a flat palette: they pick the hex that looks closest. Given semantic tokens with descriptions, they can pick by role instead. Two things help: expose only semantic color tokens to the agent (as utilities, or through a tokens file or endpoint it can read), and keep $description on every role so the choice between color.text.subtle and color.text.disabled is written down rather than guessed.
Go deeperBuilding an MCP server that serves design tokens
How public design systems structure color tokens
Reading how established systems name color roles is the fastest way to sanity-check your own vocabulary. Their token lists change between releases, so read the current documentation rather than copying names from memory:
| System | What to look at | Where to check |
|---|---|---|
| Material Design 3 | Color roles with paired “on” roles and surface containers | m3.material.io → Styles → Color → Roles |
| Atlassian Design System | Color tokens split by property (text, background, border, icon) | atlassian.design → Foundations → Color |
| GitHub Primer | Functional color tokens such as foreground, background and border roles | primer.style → Foundations → Color |
| IBM Carbon | Color tokens per theme, including layer and interactive roles | carbondesignsystem.com → Elements → Color |
A color token checklist
- Primitives are named by hue and step only, on one shared step scale.
- Components read semantic tokens; primitives are not exposed to components or utilities.
- Semantic names describe a role and a property, never a hue.
- Every fill role has a matching “on” role, and every intended pair is contrast-tested in every theme.
- Every semantic token has a value in every theme, and a missing one fails the build.
- Status colors keep their meaning across themes and brands.
- Semantic tokens carry a
$description, so people and agents choose by intent. - Token changes go through version control and review like code.
Sources and where to check
Related reading
- Semantic Tokens vs Primitive Tokens in Component Libraries
Separating primitive and semantic tokens prevents cascading edits when brand values change.
- Dark Mode Token Architecture Without Duplicate Palettes
One semantic token layer supports multiple themes without duplicating design decisions.
- Design Token Naming Conventions for Multi-Brand Systems
Name tokens by purpose, not value, and rebrands become alias swaps.
- Theming Multiple Brands From a Single Component Library
Semantic tokens move brand identity out of component code entirely.
- Exporting Figma Variables to Production Token Pipelines
Bridge design decisions between Figma and code so teams stop duplicating brand context.