Building semantic design token architectures with seamless dark mode switching
Directly referencing raw hexadecimal values in component stylesheets makes theme updates nearly impossible. Decoupling primitive color scales from functional semantic roles like surface-ground and text-subtle lets you toggle comprehensive dark and light modes with zero refactoring.
How to Use the Shade Palette & Roles (3 Simple Steps)
Input Brand Hex Colors
Enter primary, secondary, neutral, and accent hex codes, or choose from curated design system palettes.
Generate 50–900 Tonal Steps
Review mathematically balanced 50, 100, 200... 900 shade scales and check automated WCAG contrast pass/fail badges.
Copy Semantic CSS Variables
Copy structured light and dark theme role variables (--color-primary, --surface, --text-muted) in CSS or JSON format.
Features & CSS Best Practices
Perceptual 50–900 Shade Scale
Generates consistent 10-step shade palettes matching Tailwind and Material Design conventions with smooth tonal distribution.
Automated WCAG 2.1 Contrast Scoring
Evaluates color pairs against WCAG AA and AAA accessibility standards for normal text (4.5:1) and large text (3:1).
Semantic Dark/Light Mode Roles
Maps raw shades to semantic role tokens (--surface, --surface-raised, --text-primary) for effortless theme switching.
JSON & CSS Variable Export
Export your palette as standard CSS variables, Tailwind configuration objects, or design token JSON dictionaries.
Frequently Asked Questions
What is the advantage of semantic color tokens over raw hex codes?
Semantic tokens describe intent rather than appearance (e.g. --bg-surface instead of #ffffff). When switching to dark mode, only the token value changes.
What is the WCAG AA minimum contrast ratio for text?
4.5:1 for normal body text, and 3:1 for large text (18pt / 24px or bold 14pt / 18.5px).
How are 50–900 color shades calculated?
By interpolating luminance and chroma in perceptual color spaces (like OKLCH or HSLuv) from near-white (50) to deep dark tones (900).
Can I export color tokens directly to Tailwind CSS?
Yes! In the Code Panel, switch to the JSON / Tailwind tab to copy a clean theme.colors configuration object.
How do I generate an accessible color palette from a single brand hex code?
Modern tools use OKLCH perceptual color space to compute tint and shade scales with constant chroma and step-adjusted lightness, guaranteeing accessible contrast.
What is the difference between primitive, semantic, and component color tokens?
Primitive tokens define raw color values (e.g. --blue-500: #3b82f6). Semantic tokens assign contextual purpose (e.g. --color-primary: var(--blue-500)). Component tokens apply tokens locally (e.g. --btn-bg: var(--color-primary)).
How do design tokens enable seamless dark mode switching in CSS?
Define semantic tokens on the :root element for light mode, and redefine those same variable names under [data-theme="dark"] or @media (prefers-color-scheme: dark). Components update automatically without rewriting CSS rules.
Why should modern design systems adopt the OKLCH color space?
OKLCH matches human visual perception. Unlike sRGB and HSL, an OKLCH lightness value of 70% delivers identical perceived brightness across yellows, blues, and reds, making accessible color generation mathematically predictable.
How do I organize color ramps into 50 through 950 numerical scales?
Standard color token ramps use 50 (lightest tint) through 900/950 (deepest shade), with 500 representing the vibrant primary brand hue for buttons, links, and active states.