Color
The color value every color-kit API takes and returns: an OKLCH color.
import type { Color } from '@pbroom/color-kit';types.ts:10interface 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
- l
number - OKLCH lightness:
0(black) to1(white). - c
number - OKLCH chroma:
0(gray) upward. sRGB colors peak around0.32and Display P3 around0.37; there is no hard upper bound. - h
number - OKLCH hue in degrees, normally
[0, 360). Meaningless (powerless) when the color is achromatic; seeisAchromatic. - alpha
number - Opacity:
0(transparent) to1(opaque).