@pbroom/color-kit/driverColor state

colorsEqual

Channel-wise equality on OKLCH colors: true when l, c, h and alpha each differ by at most epsilon (default 0, exact). Hue is compared numerically, without wrap-around (0 and 360 differ).

functionimport { colorsEqual } from '@pbroom/color-kit/driver';color-state.ts:288
function colorsEqual(  a: Color, ,  b: Color, ,  epsilon?: number,): boolean;

Parameters

epsilon?numberdefault 0

Returns

boolean

Example

TypeScript
import { colorsEqual } from '@pbroom/color-kit/driver';

const a = { l: 0.5, c: 0.1, h: 200, alpha: 1 };
const b = { l: 0.5004, c: 0.1, h: 200, alpha: 1 };
colorsEqual(a, b); // → false
colorsEqual(a, b, 0.001); // → true