Moving from tailwind.config.js to Tailwind CSS v4's CSS-first @theme tokens and oklch() color scales feels much cleaner—until Lighthouse flags failing WCAG AA (4.5:1) contrast in dark mode or colors clip unexpectedly on sRGB displays.
1. High-Chroma OKLCH Colors Clip Outside sRGB
An accent like oklch(0.65 0.25 260) renders vividly on Display P3 laptops, then undergoes gamut mapping on standard sRGB monitors, subtly shifting perceived lightness and dropping contrast on thin UI text.
2. Dark Mode Needs Higher Lightness, Not Just Inverted Backgrounds
@import "tailwindcss"; @theme { --color-brand-500: oklch(0.58 0.19 255); --color-surface-bg: oklch(0.99 0.004 255); --color-surface-fg: oklch(0.21 0.015 255); } A L=0.58 brand accent easily clears 4.5:1 on white (L=0.99), but drops below 3.5:1 on a dark surface (L=0.16). Pairing dark themes with slightly lower chroma and L=0.72..0.78 keeps links legible without glowing harshly.
Client-Side Tools for Auditing Tokens Before Shipping
- Tailwind CSS v4
@themeBuilder (0B upload): https://global-utils.com/en/tailwind-v4-theme - WCAG Contrast Checker (AA/AAA): https://global-utils.com/en/contrast-checker
- OKLCH / HEX / RGB Color Converter: https://global-utils.com/en/color-converter
- Enterprise Tailwind v4 OKLCH Design System Suite: https://global-utils.com/en/assets/enterprise-tailwind-v4-oklch-design-system-and-gamut-mapping-suite


