oklch-skill

OKLCH color space for web projects. Convert hex/rgb/hsl to oklch, generate palettes, check contrast, handle gamut boundaries, and theme with Tailwind v4. Triggers on oklch, color conversion, palette generation, contrast ratio, gamut, display p3, design tokens, hue drift, chroma, dark mode colors.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "oklch-skill" with this command: npx skills add jakubkrehel/oklch-skill/jakubkrehel-oklch-skill-oklch-skill

OKLCH Colors

OKLCH is a perceptually uniform color space where the numbers actually mean what you think they mean. Most color problems in CSS — broken palettes, failing contrast, hue drift — come from using color spaces that don't match how we see. OKLCH fixes the model so the tools work. To explore interactively, visit oklch.fyi.

Quick Reference

CategoryWhen to useReference
ConversionHex/rgb/hsl to oklchcolor-conversion.md
PalettesGenerate scales, multi-hue, dark modepalette-generation.md
ContrastAPCA/WCAG checks, fixing failing contrastaccessibility-contrast.md
Gamut & TailwindP3 fallbacks, @theme scales, gamut clampinggamut-and-tailwind.md

Why OKLCH

  • Perceptual uniformity. Equal L steps = equal brightness. oklch(0.5 ...) is visually mid. HSL's lightness: 50% varies wildly by hue.
  • Stable hue. HSL blue shifts toward purple as lightness changes. OKLCH hue stays constant across the full lightness range.
  • Independent chroma. Chroma is an absolute measure of colorfulness that doesn't depend on lightness. HSL saturation does.
  • Finite gamut. Not every oklch value maps to a displayable sRGB color. High-chroma values at certain hues will clip — gamut awareness is required.

OKLCH Syntax

oklch(L C H)
oklch(L C H / alpha)
ChannelRangeDescription
L (Lightness)0–10 = black, 1 = white. Perceptually uniform.
C (Chroma)0–~0.4Colorfulness. 0 = gray. Max depends on L and H.
H (Hue)0–360Hue angle in degrees.
alpha0–1Optional transparency. Slash syntax.
oklch(0.637 0.237 25.331)
oklch(0.8 0.05 200 / 0.5)

Formatting: L and C use 3 decimal places, H uses up to 3. Drop trailing zeros. Format -0 as 0. Browser support: Baseline 2023, 96%+ global coverage.

Key Thresholds

RuleValue
Light/dark boundaryL > 0.6 = light background → use dark text
Lightness gap (light bg)Foreground L < 0.45 when background L > 0.85
Lightness gap (dark bg)Foreground L > 0.75 when background L < 0.25
Hue drift threshold> 10° spread across palette steps = visible drift
APCA normal text|Lc| >= 60 to pass, >= 75 for pass+
WCAG 2 normal text4.5:1 AA, 7:1 AAA
Contrast fixAdjust L only — chroma has negligible effect

Review Output Format

Always present color changes as a markdown table with Before and After columns. Include every color that was changed — not just a subset. Never list findings as separate "Before:" / "After:" lines outside of a table.

BeforeAfter
color: #3b82f6color: oklch(0.623 0.188 259.815)
Same absolute C across huesSame C% of each hue's max chroma
No sRGB fallback for P3 color@media (color-gamut: p3) wrapper

This keeps feedback scannable and diff-friendly. Each row is a self-contained change the developer can act on independently.

Common Mistakes

IssueFix
Hex/rgb/hsl color in new codeConvert to oklch()
HSL palette ramp with hue driftRebuild with constant oklch hue
Failing contrast (check foreground vs its background using APCA)Adjust oklch L channel, keep C and H
High chroma without gamut checkClamp to max chroma for the L/H in sRGB
Same absolute C across different huesUse same C% (percentage of max) for consistent vividness
P3 color without sRGB fallbackAdd @media (color-gamut: p3) pattern
Dark mode with hand-picked colorsDerive from light palette by reversing L mapping
Hex in Tailwind v4 @themeConvert to oklch values
Alpha with comma syntaxUse slash: oklch(L C H / alpha)

Reference Files

  • color-conversion.md — Supported formats, conversion examples, bulk conversion rules, what to leave alone
  • palette-generation.md — Scale convention, generation algorithm, multi-hue palettes, dark mode, why not HSL
  • accessibility-contrast.md — APCA and WCAG 2 thresholds, fixing contrast with L, lightness gap guide, hue drift detection
  • gamut-and-tailwind.md — sRGB vs P3, gamut clamping, CSS fallback patterns, Tailwind v4 @theme and migration

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

make-interfaces-feel-better

No summary provided by upstream source.

Repository SourceNeeds Review
General

A2a Match

# A2A Match - 智能供需匹配平台

Archived SourceRecently Updated
General

image-downloader

当用户需要按关键词批量下载图片、从 Bing 或多个图片来源收集候选、保存图片到本地目录、避免重复下载,或希望复用当前仓库里的现成图片下载流程时使用。遇到类似“帮我按关键词下载 10 张图片”“批量抓取 Bing 图片并保存到本地”“从多个来源收集图片候选再下载”“需要下载摘要和保存目录”这类请求时,应主动使用这个 skill。

Archived SourceRecently Updated
General

xiaoyi-claw-omega-final

六层架构智能助手文档 - 包含架构设计、身份定义、工具规则等纯文档内容。无代码执行,无外部连接,无凭据要求。

Archived SourceRecently Updated