@pbroom/color-kitConversion

linearSrgbToLinearP3Into

Convert linear sRGB to linear Display P3, writing into out (allocation-free). Combined P3fromXYZ · sRGBtoXYZ matrix from CSS Color Level 4. out may be the same object as rgb.

functionimport { linearSrgbToLinearP3Into } from '@pbroom/color-kit';p3.ts:34
function linearSrgbToLinearP3Into(  out: P3, ,  rgb: LinearRgb,): P3;

Parameters

outP3
Object to write the result into
rgbLinearRgb
Linear-light sRGB color

Returns

P3out

Example

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

const p3 = { r: 0, g: 0, b: 0, alpha: 1 };
linearSrgbToLinearP3Into(p3, { r: 1, g: 0, b: 0, alpha: 1 });
p3.r; // → ≈ 0.8225

See also