Designing Accessible Color Systems
A practical guide to contrast ratios, token naming, and dark-mode planning — with real production examples.
Color is the fastest visual signal our brain processes — but it fails us when we rely on it alone. A robust color system pairs every hue with meaning, tests every pair for contrast, and works in both light and dark contexts.
The contrast floor
Every foreground/background combination must meet a minimum contrast ratio. WCAG 2.2 AA requires 4.5:1 for body text and 3:1 for large text (18pt+ bold or 24pt+ regular).
Naming tokens by role
Name variables by what they're for, not what they look like. --color-surface survives a dark-mode flip; --color-bg-white does not.
/* ✅ Role-based (survives theme flip) */
--color-surface: #ffffff;
--color-surface-alt: #f8fafc;
--color-text-primary: #0f172a;
/* ❌ Appearance-based (breaks in dark mode) */
--color-bg-white: #ffffff;
--color-text-black: #000000;