@pbroom/color-kitConversion

toLinearSrgbInto

Convert a Color to unclamped linear-light sRGB (0-1, may fall outside that range for out-of-gamut colors), writing into out (allocation-free).

functionimport { toLinearSrgbInto } from '@pbroom/color-kit';into.ts:98
function toLinearSrgbInto(  out: LinearRgb, ,  color: Color,): LinearRgb;

Parameters

outLinearRgb
Object to write the result into
colorColor
Color to convert

Returns

LinearRgbout

Example

TypeScript
import { parse, toLinearSrgbInto } from '@pbroom/color-kit';

const linear = { r: 0, g: 0, b: 0, alpha: 1 };
toLinearSrgbInto(linear, parse('color(display-p3 1 0 0)'));
linear.r; // → ≈ 1.2249 (outside sRGB, not clipped)

See also