New to Claude Skills? Learn how to install them →

jakubkrehel on GitHub

Better Colors

Free

Enhance your web projects with OKLCH color space.

by jakubkrehel3.3k stars on jakubkrehel/skills
2 views
Updated Aug 6, 2026
Get this skill

Free · Opens the source repo

What Better Colors does

The Better Colors skill provides a comprehensive approach to utilizing the OKLCH color space in web design and development. It allows users to convert traditional color formats such as hex, RGB, and HSL into the more perceptually uniform OKLCH format. This conversion is particularly beneficial for projects that require precise color manipulation and consistency across different mediums. The skill also facilitates the generation of color palettes, making it easier to create harmonious color schemes that work well in both light and dark modes.

In addition to color conversion and palette generation, Better Colors includes tools for checking contrast ratios according to accessibility standards such as APCA and WCAG. This ensures that your designs are not only visually appealing but also accessible to all users. The skill provides guidelines for measuring contrast and fixing issues when requested, helping designers maintain compliance with accessibility requirements.

Another key feature is the integration with Tailwind CSS, allowing users to apply OKLCH colors seamlessly within their Tailwind-based projects. The skill also addresses gamut boundaries, ensuring that colors remain vibrant and true to their intended design across different displays. This is especially important for modern web projects that may rely on wide color gamuts like Display P3.

Overall, Better Colors is designed for web developers and designers who want to leverage the advantages of the OKLCH color space, enhance their color systems, and ensure that their designs are both beautiful and accessible. Its focus on semantic color usage and consistent formatting makes it a valuable addition to any design toolkit.

When to use it

Use this skill when working on web projects that require precise color management and accessibility compliance.

When not to use it

Avoid this skill if your project does not utilize the OKLCH color space or if you prefer to stick with established color systems without migration.

What you can build with it

Web Design Projects

Utilize Better Colors to create visually appealing and accessible web designs using the OKLCH color space.

Color System Migration

When transitioning to a new color system, use this skill to convert existing colors to OKLCH while maintaining consistency.

Palette Development for Dark Mode

Generate color palettes specifically tailored for dark mode, ensuring that your designs remain effective in different appearances.

How to install Better Colors

View source

1. Install with the skills CLI

npx skills add jakubkrehel/skills/better-colors --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by jakubkrehel

OKLCH Colors

OKLCH is a perceptually uniform color space where lightness, chroma, and hue are useful design controls. Use it when the project already uses OKLCH, when creating a new color system, or when the user asks for conversion or palette work. Otherwise preserve the project's established tokens and notation: a consistent hex or RGB token system is better than introducing a second color representation for an isolated fix. 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, reporting failures, fixing on requestaccessibility-contrast.md
Gamut & TailwindP3 fallbacks, @theme scales, gamut clampinggamut-and-tailwind.md
UsageSemantic tokens, one meaning per color, primary-action emphasis, appearance variantscolor-usage.md

Core Principles

1. Use a Perceptual Color Space

  • Respect the existing system. Do not convert notation merely because this skill was loaded. Reuse the project's semantic tokens and authoring format unless the task includes a color-system migration.
  • 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.

2. Write and Format OKLCH Consistently

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)

Use three decimal places for L and C and up to three for H. Drop trailing zeros and format -0 as 0. OKLCH is Baseline 2023; when support requirements are unusually broad, check the target project's browser matrix instead of relying on a fixed global-coverage percentage.

3. Measure Contrast, Gamut, and Palette Behavior

RuleValue
Light/dark boundaryL > 0.73 = light background → dark text; below it, light text still scores higher
Lightness gap (light bg)Foreground L < 0.35 when background L > 0.9
Lightness gap (dark bg)Foreground L > 0.9 when background L < 0.25
Hue drift threshold> 10° spread across palette steps = visible drift
APCA body text|Lc| >= 75 minimum, >= 90 preferred
APCA non-body text|Lc| >= 60 minimum
WCAG 2 normal text4.5:1 AA, 7:1 AAA
Contrast fix (only when asked)Adjust L first; preserve C and H when possible, then remeasure the rendered pair

Common Mistakes

IssueFix
Raw color bypasses the project's semantic token systemReuse or add the correct role token in the project's existing notation
Isolated OKLCH value introduced into a hex/RGB codebasePreserve the established notation unless the task includes a color-system migration
HSL palette ramp with hue driftRebuild with constant oklch hue
Failing contrast (check foreground vs its background using APCA)Report the pair, its measured Lc and the threshold it misses; change colors only when asked (then adjust L, 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 created by mechanically reversing the light paletteUse the light palette as a starting point, then tune chroma and lightness and recheck every foreground/background pair
Hex in Tailwind v4 @themeConvert to oklch values
Alpha with comma syntaxUse slash: oklch(L C H / alpha)
Same hue means two different things (link color reused decoratively)One color, one meaning; give the second use a neutral
Semantic token used outside its role (separator as text)Add a token for the missing role; never borrow by value
Several colored control backgrounds in one viewFill only the single primary action; secondaries stay neutral
Palette verified only in light modeRecheck every foreground/background pair in both appearances

Review Output Format

Use this format only when the user asks for a standalone color review. When better-interface orchestrates the review, provide domain evidence and findings to that skill and let its output format, severity scale, consolidation rules, cap, and verdict take precedence.

Present the standalone review in two parts.

Findings

Group all confirmed findings by principle. Use a markdown table with Severity, Location, Before, After, and Why columns. Never use separate "Before:" / "After:" lines.

  • Severity: HIGH makes content unreadable or assigns a misleading semantic color; MEDIUM creates a noticeable theme, gamut, or consistency failure; LOW is isolated polish.
  • Location: cite path/to/file:line. If the artifact has no source files, cite the exact screen and component instead.
  • Before / After: show the current value or token and the exact replacement.
  • Why: name the violated principle and include measured contrast or gamut evidence when relevant.

Consolidate a repeated systemic issue into one row and list every affected location. Omit principles with no findings.

SeverityLocationBeforeAfterWhy
MEDIUMsrc/theme.css:18color: #3b82f6color: oklch(0.623 0.188 259.815)New project colors use OKLCH tokens
MEDIUMsrc/palette.ts:31Same absolute C across huesSame C% of each hue's maximum chromaEqual chroma values do not appear equally vivid across hues
HIGHsrc/theme.css:52P3 color with no fallbackAdd an sRGB fallback before @media (color-gamut: p3)The color fails on non-P3 displays

Verification and Verdict

After the findings:

  1. Verification: list the exact checks run and their observed results, including contrast measurements, gamut checks, and both light and dark appearances when applicable. If a check was not run, state what still needs verification.
  2. Verdict: Block if any HIGH finding remains, Needs changes if only MEDIUM or LOW findings remain, and Approve only when no actionable findings remain.

When there are no findings, omit the table, state "No actionable color findings", report verification, and end with Approve.

Frequently asked questions about Better Colors

Similar skills