Building Contrast-Safe Design Tokens With OKLCH for Light & Dark Modes
Why perceptual lightness uniformity in OKLCH prevents muddy brand accents and preserves WCAG 2.2 AA contrast across themes.
Oranov360 Product & UX Studio
Product Strategy, Design Systems & Accessibility Practice
- Published
- Updated

Three-tier semantic token architecture in OKLCH color space
01 · Section
Why Hex Brand Colors Fail in Dark Surfaces
Warm orange and terracotta tones are expressive in light themes, yet the exact same hex value used as button text on white will fail WCAG contrast or vibrate uncomfortably against deep charcoal surfaces in dark mode. HSL masks these shifts because equal lightness values look wildly different across hues.
OKLCH models lightness perceptually (0 to 1), chroma (saturation), and hue angle (0–360 degrees). When we map semantic tokens like --brand-text separately for light and dark surfaces, typography and interactive badges keep both brand identity and crisp readability.
02 · Section
Three-Tier CSS Token Architecture
export const SEMANTIC_SURFACE_TOKENS = { light: { background: "oklch(0.992 0.004 75)", // Warm white canvas foreground: "oklch(0.185 0.012 45)", // Deep charcoal ink brandText: "oklch(0.515 0.185 37)", // High-contrast burnt orange }, dark: { background: "oklch(0.15 0.009 45)", // Calm dark stone foreground: "oklch(0.965 0.006 70)", // Soft warm alabaster brandText: "oklch(0.79 0.155 52)", // Lifted amber-orange for legibility },} as const;03 · Section
Fluid Scaling Without Breaking 200% Zoom
Keeping clamp() maximum font sizes at or below 2.5x the minimum value guarantees that browser zoom at 200% still produces measurable enlargement under WCAG 1.4.4, while min-block-size prevents button labels from clipping when users customize text spacing.
Key Takeaways
- Separate literal brand hues (Tier 1) from semantic role tokens like --brand-text and --primary (Tier 2).
- Adjust perceptual lightness (L) intentionally between light and dark modes so small text remains >= 4.5:1 contrast.
- Honor forced-colors: active and prefers-reduced-motion media rules directly in global base tokens.
Get future engineering essays & architecture playbooks
Applying these architecture ideas to your own platform?
Partner with Oranov360 Labs Ltd. for technical scoping, SaaS product architecture, custom software engineering, or legacy system modernization.


