@pbroom/color-kitConversion

linearP3ToLinearSrgbInto

Convert linear Display P3 to linear sRGB, writing into out (allocation-free). out may be the same object as p3.

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

Parameters

outLinearRgb
Object to write the result into
p3P3
Linear-light Display P3 color

Returns

LinearRgbout

Example

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

const linear = { r: 0, g: 0, b: 0, alpha: 1 };
linearP3ToLinearSrgbInto(linear, { r: 1, g: 0, b: 0, alpha: 1 });
linear.r; // → ≈ 1.2249 (outside sRGB)

See also