@pbroom/color-kitGamut

inP3Gamut

Returns whether an OKLCH color is inside the Display P3 gamut.

functionimport { inP3Gamut } from '@pbroom/color-kit';membership.ts:140
function inP3Gamut(color: Color): boolean;

Tests the unclamped linear Display P3 channels with isLinearRgbInGamut (so clamping in toP3 cannot produce a false positive), allowing GAMUT_EPSILON of slack on the encoded channels. Allocation-free.

Parameters

Returns

boolean

Example

TypeScript
import { inP3Gamut, inSrgbGamut } from '@pbroom/color-kit';

const green = { l: 0.7, c: 0.2, h: 150, alpha: 1 };
inP3Gamut(green); // → true
inSrgbGamut(green); // → false

See also