oklch-skill
Practical OKLCH color workflow skill for building consistent, accessible, and tunable color systems in modern UIs.
Install
npx skills add https://github.com/jakubkrehel/oklch-skill --skill oklch-skillGamut Awareness & Tailwind v4
sRGB vs Display P3
Every sRGB color exists within Display P3, but not every P3 color exists within sRGB. Display P3 covers ~50% more colors.
Max chroma varies by lightness and hue
The gamut boundary is irregular. At L=0.5 in sRGB:
- Highest chroma: purple (H ≈ 285) at C ≈ 0.29
- Red-orange (H ≈ 0-30): C ≈ 0.20
- Lowest chroma: cyan (H ≈ 195) at C ≈ 0.09
The peak hue shifts with lightness. At L=0.7 magenta peaks, at L=0.9 green peaks. Cyan consistently has the lowest max chroma.
Gamut checking
If a color's chroma exceeds the maximum for its L/H/space, it clips. The fix: reduce chroma while keeping L and H constant.
CSS fallback patterns
For browsers without oklch support:
Tailwind v4
Tailwind CSS v4 defines its default palette in oklch. Custom themes should follow the same convention.
Custom color scale with @theme
This gives you bg-brand-500, text-brand-200, etc. automatically.
Opacity modifiers
Tailwind's opacity modifier syntax works with oklch:
Migrating existing themes
- Convert all hex values in
@themeto oklch - Replace any
theme()references that used hex - Test dark mode — oklch values may look slightly different due to perceptual accuracy
- Check for hardcoded hex in component code and convert those too