A team changes one blue in its palette. The button still looks right, but when someone tabs to it on a gray card, the focus ring gets hard to see. Tokens make the change easy to trace. They cannot tell you whether the colors still work together. Here is one button you can follow from a JSON file to the browser, with the pairs to test at the end.
Trace one button through three layers
- Primitive:
primitive.blue-600stores the sRGB value#1D4ED8. It does not decide where that color belongs. - Semantic:
semantic.action-fillrefers to that primitive. It names the use, so changing the action color does not require renaming the role. - Component:
component.button-primary-fillrefers to the semantic role. This extra alias is useful if the primary button later needs a different fill from other actions.
The DTCG 2025.10 format defines the JSON representation and reference syntax; the Color Module defines the sRGB color object. It is a stable Community Group specification, not a W3C Recommendation. The three layers are a design choice, not a format requirement. Verify your own export and build path before assuming that two tools resolve this file identically.
{
"$type": "color",
"primitive": {
"white": { "$value": { "colorSpace": "srgb", "components": [1, 1, 1], "hex": "#FFFFFF" } },
"gray-50": { "$value": { "colorSpace": "srgb", "components": [0.95686275, 0.96470588, 0.97254902], "hex": "#F4F6F8" } },
"ink-900": { "$value": { "colorSpace": "srgb", "components": [0.06666667, 0.09411765, 0.15294118], "hex": "#111827" } },
"blue-600": { "$value": { "colorSpace": "srgb", "components": [0.11372549, 0.30588235, 0.84705882], "hex": "#1D4ED8" } },
"blue-700": { "$value": { "colorSpace": "srgb", "components": [0.11764706, 0.25098039, 0.68627451], "hex": "#1E40AF" } }
},
"semantic": {
"surface-subtle": { "$value": "{primitive.gray-50}" },
"text-primary": { "$value": "{primitive.ink-900}" },
"action-fill": { "$value": "{primitive.blue-600}" },
"action-fill-hover": { "$value": "{primitive.blue-700}" },
"action-label": { "$value": "{primitive.white}" },
"focus-ring": { "$value": "{primitive.blue-700}" }
},
"component": {
"button-primary-fill": { "$value": "{semantic.action-fill}" },
"button-primary-fill-hover": { "$value": "{semantic.action-fill-hover}" },
"button-primary-label": { "$value": "{semantic.action-label}" },
"button-primary-focus": { "$value": "{semantic.focus-ring}" }
}
}Try the button in a browser
Save the next block as an HTML file and open it in a browser. The CSS is a hand-written equivalent of the JSON, so you can try the mapping without a token build tool. Hover over the button, move the pointer away, then tab to it and press Enter. The white label stays; the fill darkens on hover; a separate, offset outline appears on keyboard focus. The button reveals a short note, and its expanded state is exposed to assistive technology.
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Color token button example</title>
<style>
:root {
--primitive-white: #FFFFFF;
--primitive-gray-50: #F4F6F8;
--primitive-ink-900: #111827;
--primitive-blue-600: #1D4ED8;
--primitive-blue-700: #1E40AF;
--semantic-surface-subtle: var(--primitive-gray-50);
--semantic-text-primary: var(--primitive-ink-900);
--semantic-action-fill: var(--primitive-blue-600);
--semantic-action-fill-hover: var(--primitive-blue-700);
--semantic-action-label: var(--primitive-white);
--semantic-focus-ring: var(--primitive-blue-700);
--component-button-primary-fill: var(--semantic-action-fill);
--component-button-primary-fill-hover: var(--semantic-action-fill-hover);
--component-button-primary-label: var(--semantic-action-label);
--component-button-primary-focus: var(--semantic-focus-ring);
}
body { font: 1rem system-ui; margin: 1rem; }
main {
background: var(--semantic-surface-subtle);
color: var(--semantic-text-primary);
padding: 1.5rem;
}
.primary {
font: inherit;
padding: 0.65rem 1rem;
border: 0;
border-radius: 0.375rem;
background: var(--component-button-primary-fill);
color: var(--component-button-primary-label);
}
.primary:hover { background: var(--component-button-primary-fill-hover); }
.primary:focus-visible {
outline: 2px solid var(--component-button-primary-focus);
outline-offset: 3px;
}
</style>
<main>
<h1>Palette settings</h1>
<button class="primary" type="button" aria-expanded="false"
aria-controls="details">Contrast details</button>
<p id="details" hidden>The button label is white in both states.</p>
</main>
<script>
const button = document.querySelector('.primary');
const details = document.getElementById('details');
button.addEventListener('click', () => {
const expanded = button.getAttribute('aria-expanded') === 'true';
button.setAttribute('aria-expanded', String(!expanded));
details.hidden = expanded;
});
</script>
</html>The outline is offset so the gray surface separates it from the blue fill. That detail changes which colors are adjacent. If you remove the gap or place the control on another surface, test again instead of carrying over the same contrast result.
Reference colors and their jobs
These ten sRGB values are examples, not a required palette. The five primitives above power the button demo. The other five illustrate additional roles you would verify separately.
| Role | HEX | RGB | HSL |
|---|---|---|---|
| White canvas or button label | #FFFFFF | 255, 255, 255 | 0°, 0%, 100% |
| Subtle surface | #F4F6F8 | 244, 246, 248 | 210°, 22%, 96% |
| Primary text on light surfaces | #111827 | 17, 24, 39 | 221°, 39%, 11% |
| Secondary text on light surfaces | #4B5563 | 75, 85, 99 | 215°, 14%, 34% |
| Default button fill | #1D4ED8 | 29, 78, 216 | 224°, 76%, 48% |
| Hover fill and spaced focus outline on gray | #1E40AF | 30, 64, 175 | 226°, 71%, 40% |
| Success text on white | #047857 | 4, 120, 87 | 163°, 94%, 24% |
| Error text on white only in this example | #DC2626 | 220, 38, 38 | 0°, 72%, 51% |
| Dark canvas | #0B0F19 | 11, 15, 25 | 223°, 39%, 7% |
| Primary text on the dark canvas | #F3F4F6 | 243, 244, 246 | 220°, 14%, 96% |
Test the resolved pairs, not the swatches
Under WCAG 2.2 SC 1.4.3, AA requires 4.5:1 for normal text and 3:1 for large text. The AAA text thresholds in SC 1.4.6 are 7:1 and 4.5:1 respectively. SC 1.4.11 is a separate 3:1 requirement against adjacent colors where visual information is needed to identify a control or its state, subject to exceptions such as inactive controls. It does not require every decorative divider to reach 3:1.
| What is tested | Color pair | Contrast | Result |
|---|---|---|---|
| Default button label | #FFFFFF / #1D4ED8 | 6.70:1 | AA normal text |
| Hover button label | #FFFFFF / #1E40AF | 8.72:1 | AAA normal text |
| Default button fill on gray | #1D4ED8 / #F4F6F8 | 6.19:1 | Meets 3:1 for the visible boundary |
| Hover fill and spaced focus outline on gray | #1E40AF / #F4F6F8 | 8.05:1 | Meets 3:1 against the adjacent surface |
| Body text on white | #111827 / #FFFFFF | 17.74:1 | AAA normal text |
| Body text on gray | #111827 / #F4F6F8 | 16.37:1 | AAA normal text |
| Dark theme body text | #F3F4F6 / #0B0F19 | 17.40:1 | AAA normal text |
| Secondary text on white | #4B5563 / #FFFFFF | 7.56:1 | AAA normal text |
| Secondary text on gray | #4B5563 / #F4F6F8 | 6.98:1 | AA normal text, not AAA |
| Success text on white | #047857 / #FFFFFF | 5.48:1 | AA normal text |
| Error text on white | #DC2626 / #FFFFFF | 4.83:1 | AA normal text |
| Same error text on gray | #DC2626 / #F4F6F8 | 4.46:1 | Fails AA for normal text |
| Default blue on the dark canvas | #1D4ED8 / #0B0F19 | 2.86:1 | Below 3:1; do not reuse as the sole required boundary |
Ratios use linearized sRGB relative luminance and are rounded for display only. The error red is a useful regression: moving a form from white to gray can break its contrast without any token value changing. One fix is to keep the error message in the tested primary ink on gray and say what went wrong in text. A colored accent can supplement the message; it should not carry it alone. Check that keyboard focus is visible in context as well as measuring its contrast.
Keep the test next to the token change
- Record the component, state, foreground, adjacent surface and minimum ratio. Resolve aliases for each theme rather than testing every primitive against white.
- Recheck the browser output when a primitive, alias or component background changes. Use the final displayed colors if opacity or layering affects the pair.
- Tab through the rendered control and verify its focus and state without relying on hue alone. A passing color pair does not certify the whole component.
Check a foreground and background in the Contrast Checker. For a screenshot audit, Analyze Your Image can surface dominant rendered colors as a starting point, but screenshots do not reveal the source token names or every interaction state.
Frequently asked questions
Is DTCG 2025.10 a W3C standard?
No. It is a stable specification published by the Design Tokens Community Group, not a W3C Recommendation. Check which parts of the format your tools support before adopting it.
Do color tokens guarantee accessible contrast?
No. Tokens let you name and reuse a choice. Contrast is measured between the resolved colors on a particular surface, in a particular state. Test the pair, not the token name.
Does every component need its own tokens?
No. A component can consume semantic tokens directly. Add a component alias when you need a distinct usage contract or expect that component to diverge without changing the system-wide role.