@pbroom/color-kitGamut

toP3GamutInto

Map a Color to the Display P3 gamut, writing the result into out (allocation-free). Same algorithm and bit-identical result as toP3Gamut; out may be the same object as color.

functionimport { toP3GamutInto } from '@pbroom/color-kit';membership.ts:347
function toP3GamutInto(
  out: Color,
  color: Color,
  options?: GamutMapOptions,
): Color;

Parameters

Returns

Color

Example

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

const mapped = { l: 0, c: 0, h: 0, alpha: 1 };
toP3GamutInto(mapped, { l: 0.7, c: 0.4, h: 150, alpha: 1 });
mapped; // → { l: 0.7, c: ≈ 0.2689, h: 150, alpha: 1 }