@pbroom/color-kitConversion

fromLinearSrgbInto

Convert linear-light sRGB to a Color, writing into out (allocation-free). Inputs are not clamped.

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

Parameters

outColor
Color to write the result into
linearLinearRgb
Linear-light sRGB color

Returns

Colorout

Example

TypeScript
import { fromLinearSrgbInto, toHex } from '@pbroom/color-kit';

const color = { l: 0, c: 0, h: 0, alpha: 1 };
fromLinearSrgbInto(color, { r: 1, g: 0.2, b: 0, alpha: 1 });
toHex(color); // → '#ff7c00'