---
name: "colorjs-color-space-conversion"
description: "Perform color space conversions and perceptual color math with Color.js."
metadata:
  author: "Lea Verou & Chris Lilley"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "convert srgb to oklch"
  - "calculate delta e color difference"
  - "map color to display p3 gamut"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Color.js OKLCH, Display P3 & Lab Color Engine

Executes color conversions across RGB, Display P3, OKLCH, CIELAB, and HSL using Color.js: color gamuts, Delta E 2000 perceptual distance, WCAG 2.1/3.0 contrast, and smooth gamut mapping.

## When to Invoke
Invoke this skill whenever you need to:
- convert srgb to oklch
- calculate delta e color difference
- map color to display p3 gamut

## Execution SOP & Rules
1. Parse and convert colors cleanly: const color = new Color('#3b82f6').to('oklch').
2. Format modern CSS strings using color.toString({ format: 'oklch' }).
3. Calculate perceptual difference with colorA.deltaE2000(colorB).
4. Ensure colors are mapped into target display gamuts with color.toGamut({ space: 'srgb' }).

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
