@pbroom/color-kitConversion

fromP3Into

Convert Display P3 (gamma-encoded, 0-1) to a Color, writing into out (allocation-free). Bit-identical to fromP3.

functionimport { fromP3Into } from '@pbroom/color-kit';into.ts:206
function fromP3Into(  out: Color, ,  p3: P3,): Color;

Parameters

outColor
Color to write the result into
p3P3
Gamma-encoded Display P3 color

Returns

Colorout

Example

TypeScript
import { fromP3Into, toCss } from '@pbroom/color-kit';

const color = { l: 0, c: 0, h: 0, alpha: 1 };
fromP3Into(color, { r: 1, g: 0, b: 0, alpha: 1 });
toCss(color, 'oklch'); // → 'oklch(0.6486 0.2995 28.96)'