srgbToLinearInto
Convert sRGB (0-255) to linear RGB (0-1), writing into out (allocation-free). out may be the same object as rgb.
import { srgbToLinearInto } from '@pbroom/color-kit';srgb.ts:27function srgbToLinearInto( out: LinearRgb, , rgb: Rgb,): LinearRgb;Parameters
Returns
LinearRgbout
Example
import { srgbToLinearInto } from '@pbroom/color-kit';
const linear = { r: 0, g: 0, b: 0, alpha: 1 };
srgbToLinearInto(linear, { r: 255, g: 128, b: 0, alpha: 1 });
linear.g; // → ≈ 0.2159