@pbroom/color-kitGamut

toSrgbGamutInto

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

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

Parameters

Returns

Color

Example

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

const mapped = { l: 0, c: 0, h: 0, alpha: 1 };
toSrgbGamutInto(mapped, { l: 0.7, c: 0.35, h: 150, alpha: 1 });
mapped; // → { l: 0.7, c: ≈ 0.1928, h: 150, alpha: 1 }