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.
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.
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)
--color-primary-50, --color-primary-100, up to --color-primary-900. Light to dark.
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)
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-900text works on--color-neutral-50,--color-neutral-100, or white.--color-neutral-600text works only on white or very light backgrounds.--color-primary-500as a background requires--color-neutral-50or white text;--color-neutral-900text will fail contrast.
Process 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
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.
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
tailwind.config.js. CSS-in-JS users import tokens from a JavaScript file. The principle is the same: one source of truth, referenced everywhere.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
- 🎨 Mastering Color Decisions in Design Systems Choosing ... - Choosing the right colors in a design system isn't just about aesthetics—it's about clarity, consistency, and accessibility. Test new palettes ...
- How color schemes influence User Experience? | by FeDev - Achieving optimal color contrast enhances readability and accessibility, ensuring that information is easily comprehensible for all users.
- Color Systems: The complete masterclass for Product Designers - The professional approach is to use contrast as a hierarchy system. ... The 200 stop should look right as a border color on a white surface.
