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-skillAccessibility & Contrast
Contrast is always measured between a foreground color (text, icon, or UI element) and the background color it sits on. When checking contrast, identify the background the element will be rendered against — typically the nearest parent's background color.
APCA thresholds (recommended)
APCA (Accessible Perceptual Contrast Algorithm) is more perceptually accurate than WCAG 2 and pairs naturally with oklch since both are grounded in perceptual lightness. Use APCA as the default.
Lc (Lightness Contrast) measures the perceived contrast between foreground and background. These are conservative approximations:
APCA's Lc value is signed — positive means light text on dark background, negative means dark text on light. Use the absolute value for threshold comparison.
WCAG 2 thresholds (for legal compliance)
WCAG 2 is still required when making formal WCAG 2.x conformance claims. It uses a luminance ratio that can be both too strict and too lenient depending on the color pair.
Fixing contrast with oklch
In hex/rgb, fixing contrast means trial and error across three channels. In oklch, contrast is controlled by lightness (L) alone — adjust the L distance between the foreground and its background:
Chroma has negligible effect on contrast — always adjust L, never C.
Quick lightness gap guide
- Light background (L > 0.85): foreground L should be below 0.45
- Dark background (L < 0.25): foreground L should be above 0.75
These are approximations — always verify with an actual contrast calculation.
Light vs dark color detection
A color is considered light when its oklch lightness exceeds 0.6:
Hue drift detection
To detect hue drift in an existing HSL palette:
- Convert each step to oklch
- Compare the H values across steps
- If the hue spread is greater than 10°, the palette has visible drift