@pbroom/color-kitGamut

toP3Gamut

Map a Color to the Display P3 gamut. Same methods and options as toSrgbGamut; the default reduces OKLCH chroma at fixed L and h.

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

function toP3Gamut(
  color: Color,
  options: GamutMapOptions | undefined,
): Color;

Colors already in gamut (per inP3Gamut) are returned unchanged. Returns a new object.

Overload 1 of 2

Parameters

Returns

Color

Overload 2 of 2

Parameters

Returns

Color

Example

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

toP3Gamut({ l: 0.7, c: 0.35, h: 150, alpha: 1 });
// → { l: 0.7, c: ≈ 0.2689, h: 150, alpha: 1 }

See also