API

@pbroom/color-kit

The engine: OKLCH-canonical conversion, contrast, gamut mapping, harmony, manipulation and plane queries.

144 exports107 values37 types133 re-exportsalso @pbroom/color-kit/core

@pbroom/color-kit is the everyday import. Every function takes and returns the same value, an OKLCH Color ({ l, c, h, alpha }), so results compose without conversions in between. It runs in any JavaScript runtime and has no React dependency. @pbroom/color-kit/core is an alias of this entry.

Domains

The root also re-exports the plane, interop and HCT helpers; their pages live under those entry points.

brand.ts
import {
  contrastRatio,
  inSrgbGamut,
  parse,
  toCss,
  toSrgbGamut,
} from '@pbroom/color-kit';

const brand = parse('oklch(0.62 0.24 290)');
inSrgbGamut(brand); // → false
const shown = toSrgbGamut(brand); // chroma reduced, lightness and hue kept
toCss(shown, 'hex'); // → '#8a62ff'
// Measure the hex you ship: 8-bit channels, not the unrounded color.
const white = parse('#fff');
contrastRatio(shown, white, { precision: '8bit' }).toFixed(2); // → '3.98'

Start with OKLCH-canonical colors and Requested vs displayed.

Types

Conversion

Contrast

Harmony

Scale

Utilities

Interpolation

Manipulation

Gamut

Re-exported here

@pbroom/color-kit also exports 133 symbols documented in a more specific entry point. Import them from either path; they are the same declarations.

@pbroom/color-kit/plane94