@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).
import { colorsEqual } from '@pbroom/color-kit/driver';color-state.ts:288function colorsEqual( a: Color, , b: Color, , epsilon?: number,): boolean;Parameters
- epsilon?
numberdefault0
Returns
boolean
Example
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