Your design system is either your biggest asset or your biggest mess. Most teams pick hex codes ad-hoc, store them nowhere official, and then watch designers and developers argue about which shade of blue was "the one." Contrast breaks. Accessibility fails. Conversions suffer. The fix is simpler than you think: design system color tokens.

Photo by Thắng-Nhật Trần from Pexels

TL;DR

  • Use color tokens, not hex codes. A token is a single source of truth: one name (like --color-primary-500), one value, one place to update it. Designers use the token name in design files; developers import the same token into code.
  • Contrast failures cascade. When hex codes scatter across your codebase, you can't verify contrast ratios globally. One off-brand color choice breaks WCAG AA for 8% of your visitors.
  • Tokens scale across products. A single color audit fixes contrast for your entire product line, not one page at a time.
0%
Visitors Who May Struggle with Poor Contrast
Key takeaway: A color token system lets you define contrast once, audit it once, and ship it everywhere. No more hunting for hex codes or guessing whether a button passes WCAG AA.

Why this matters now

Contrast is no longer a "nice to have." The European Accessibility Act (EAA) and similar regulations are tightening. WCAG compliance is moving from a checkbox to a legal requirement. And your competitors are already doing this.

But there's a bigger reason: contrast failures directly hurt conversion. Research shows that poor contrast reduces readability, increases cognitive load, and makes first-time visitors less likely to understand your value prop. Dark grays on slightly-darker grays might look sleek to the design team. To 8% of your audience, it's a wall of text they can't read.

0%
of Visitors Who May Struggle with Your Website

Add poor contrast to confusing copy or unclear CTAs, and that 8% becomes 40+% of visitors who bounce before they even try to convert.

The antidote is a color system where contrast is baked in, not bolted on.

The mistakes most teams make

One-off hex codes everywhere

Your design file has a button color: #2D3436. Your CSS has a slightly different shade: #2D3B45. Your marketing site uses #303A42. None of them are documented. When a designer leaves, nobody knows which one is official.

Result: scattered colors, inconsistent contrast, and an audit nightmare.

No contrast verification at system level

You might have a design token system, but you're not checking contrast ratios for every combination of foreground and background colors. You assume that if each color "looks okay" on white, it's fine everywhere.

Then a developer pairs your light gray text (#757575) with your light background (#F5F5F5). Contrast ratio: 3.5:1. WCAG AA requires 4.5:1 for body text. A visitor with mild low vision gives up. Another bounce.

Tokens without developer buy-in

Design hands off a Figma file with token names. Developers don't have those tokens in their build pipeline. So they use the hex values manually, defeating the entire point.

Six months later, the design team wants to adjust --color-primary-500 to fix a contrast issue. The developers' code doesn't reference tokens at all. They update the design file, ship a new design, and the old hex code stays live. Two different colors.

No testing across use cases

You test your primary blue button on a white background. Contrast: ✓ Pass. But that same blue is used as a text color on a light gray card. Different contrast ratio. Different outcome.

Most color systems test only the "happy path," not every combination your product actually uses.

How to build a token-first system

Step 1: Define your color palette

Start with intention. What are your brand colors? How many shades of each do you need?

Most teams need:
  • Primary color (brand-defining; used for CTAs, links, highlights)
  • Secondary color (supporting accent; less frequent)
  • Neutrals (grays for text, backgrounds, dividers)
  • Semantic colors (red for error, green for success, yellow for warning)
For each, define a scale. Figma's color scales or Material Design's system are both solid starting points. Don't just pick random shades. Use a naming convention that makes sense: --color-primary-50, --color-primary-100, up to --color-primary-900. Light to dark.
design tools
Photo by Ono Kosuki from Pexels

Step 2: Audit contrast for every combination

This is the step most teams skip. It's also the most important.

Create a matrix: all foreground colors × all background colors you actually use. For each pair, measure the contrast ratio using WebAIM or the Accessible Colors tool.

For example:
  • Primary text (--color-neutral-900) on white background: 16:1 ✓ (well above 4.5:1 AA)
  • Primary text (--color-neutral-900) on light gray (--color-neutral-100): 8.2:1 ✓
  • Secondary text (--color-neutral-600) on white: 6.8:1 ✓
  • Secondary text (--color-neutral-600) on light gray: 2.1:1 ✗ (too low; remove this combination)
Mark unsafe combinations as "do not use together." Document it. Make it searchable.
website planning
Photo by Tranmautritam from Pexels

Step 3: Encode tokens in your design tool

Figma, Adobe XD, and Sketch all support color variables now. Create a library:

Colors / Primary / 50
Colors / Primary / 100
Colors / Primary / 500
...
Colors / Semantic / Error
Colors / Semantic / Success

Name them to match your code tokens. When design and code use the same names, mistakes drop dramatically.

Step 4: Export tokens to code

Use a tool like Tokens Studio, Style Dictionary, or Panda CSS to export your design tokens to CSS, JavaScript, or whatever your stack uses.

Your output in CSS might look like:

:root {
  --color-primary-50: #EFF6FF;
  --color-primary-500: #3B82F6;
  --color-primary-900: #1E3A8A;
  --color-neutral-600: #4B5563;
  --color-semantic-error: #DC2626;
}

Developers import these variables, not hex codes. Update the export, redeploy, and every color everywhere changes at once.

Step 5: Document allowed pairings

Your system guide should say:

  • --color-neutral-900 text works on --color-neutral-50, --color-neutral-100, or white.
  • --color-neutral-600 text works only on white or very light backgrounds.
  • --color-primary-500 as a background requires --color-neutral-50 or white text; --color-neutral-900 text will fail contrast.
Make this searchable. Make it visual. A table or an interactive preview beats a PDF.

Process at a glance

Design System Colors: One Source of Truth for Contrast process
Figure 1: Design System Colors: One Source of Truth for Contrast at a glance.

Real-world examples

Example 1: SaaS dashboard

Before: Dashboard used 47 different grays across navigation, cards, and text. Contrast ratios ranged from 2:1 to 18:1. Audit found 12 combinations below 4.5:1.

After: Token system with 5 neutral shades, each contrast-verified for its use case. Every gray was either "heading text," "body text," "disabled state," "divider," or "subtle background." Same visual richness, zero contrast violations.

Result: Accessibility audit pass. No visible redesign needed.

Example 2: E-commerce site

Before: Primary CTA button used #FF6B35 (brand orange) text on white. Contrast: 5.2:1 ✓ Pass. But the same orange was used as a background color for discount badges, with white text inside. Contrast: 3.9:1 ✗ Fail.

After: Split the token. --color-primary-cta (for text on white) is the original #FF6B35. --color-primary-bg (for backgrounds requiring white text) is #D84315 (darker). Both pass 4.5:1. Designers and developers now use the right token for the context.

Result: Discount badges became readable. Conversion on badge clicks went up 14%.

Example 3: Multi-product company

Before: Three separate products had three separate color palettes, none documented as tokens. Brand refresh required manual updates to all three. Took 8 weeks. Contrast ratios were never verified for products 2 and 3.

After: Single token library shared across all products via npm package. Brand change: update the tokens, publish, and all three products redeploy. Takes 2 days. Contrast verified once, applies everywhere.

Result: Faster iteration. Lower maintenance. Consistent user experience across the product line.


Example: Color Token System

--color-primary-500
#3B82F6 WCAG AAA
--color-neutral-900
#0F172A WCAG AAA
--color-semantic-error
#DC2626 WCAG AA
--color-neutral-100
#F1F5F9 WCAG AA
--color-success
#16A34A WCAG AA

The dashboard above shows a sample token library. Each token is a single source of truth. Designers reference the token name in their design files. Developers pull the same token into code. Update the token value once, and it cascades everywhere.

Reduction in Contrast Bugs After Token System Implementation (Median)
0%

How PagePerson helps

When you build a design system, you're optimizing for the average user. But your real challenge is the edge cases: low-vision users, people with color blindness, users on older devices with poor contrast, users under cognitive load.

PagePerson Insights gives you a direct window into how real visitors actually perceive your colors. The extension analyzes your live site and surfaces contrast failures in context: which elements fail, where, and why a specific visitor is struggling.

More importantly, PagePerson shows you which contrast failures hurt conversion the most. You might have 30 WCAG violations. But maybe only 5 of them appear on your critical path (sign-up form, pricing table, CTA buttons). Fix those five first. You'll see the impact immediately.

Use PagePerson alongside your token system: build tokens for contrast safety, then verify with real-user perception. It's the difference between "our system passes automated checks" and "visitors actually understand our site."


Build Your Color Token System

Your progress is saved automatically in your browser.


FAQ

Frequently Asked Questions

Any team shipping a product to multiple users. If you have more than one designer, or more than one developer, you have enough complexity to benefit from tokens. Startups with one designer and one developer can skip this for now. Mid-size teams (5+ people) should have tokens before your system gets out of hand. Large organizations must have tokens or face constant rework and accessibility debt.
Start with what you have. Audit your existing colors for contrast. Create a naming convention. Export those colors to tokens. You don't need to redesign everything. You're just giving names to what already exists, and verifying contrast. Do this in parallel with your next release cycle, not as a separate project.
Track two things: accessibility violations (use an automated scanner like axe DevTools) and conversion metrics (track CTR on buttons, sign-up completion rate, time on page). After implementing tokens, you should see fewer violations. If your CTR or sign-ups go up, you've reduced friction for a segment of your audience that was being excluded.
Yes. Create token scales for both light and dark themes. Use CSS custom properties with media queries, or swap token values at runtime. Tokens are agnostic to theme. Your token system becomes even more valuable in dark mode because contrast requirements don't change, but color values do. With tokens, you update once and both themes ship correctly.
Tokens work with every stack. Tailwind users export tokens to tailwind.config.js. CSS-in-JS users import tokens from a JavaScript file. The principle is the same: one source of truth, referenced everywhere.
Add contrast testing to your CI/CD pipeline. Tools like pa11y or axe-core can run automated checks. But also use PagePerson on your live site to catch issues that automated tools miss. Real visitor feedback beats automated checks every time.

The payoff of a token system is a product that works for everyone, not just the 92% with typical vision. Contrast stops being something you fix at the end. It becomes something you prevent from the start. One place. One definition. One audit. Everything else follows.

Additional Resources