@pbroom/color-kitTypes

Color

The color value every color-kit API takes and returns: an OKLCH color.

interfaceimport type { Color } from '@pbroom/color-kit';types.ts:10
interface Color {
  l: number;
  c: number;
  h: number;
  alpha: number;
}

OKLCH is the polar form of OKLab, a perceptually uniform space, so equal steps in l, c or h look like roughly equal visual changes. A Color is not tied to a gamut: it can describe colors outside sRGB or Display P3 (see inSrgbGamut / toSrgbGamut). Create one with parse, fromRgb, fromHex and friends, or as a plain object literal.

Properties

lnumber
OKLCH lightness: 0 (black) to 1 (white).
cnumber
OKLCH chroma: 0 (gray) upward. sRGB colors peak around 0.32 and Display P3 around 0.37; there is no hard upper bound.
hnumber
OKLCH hue in degrees, normally [0, 360). Meaningless (powerless) when the color is achromatic; see isAchromatic.
alphanumber
Opacity: 0 (transparent) to 1 (opaque).