linearToSrgbInto
Convert linear RGB (0-1) to sRGB (0-255, rounded and clamped), writing into out (allocation-free). out may be the same object as linear.
import { linearToSrgbInto } from '@pbroom/color-kit';srgb.ts:79function linearToSrgbInto( out: Rgb, , linear: LinearRgb,): Rgb;Parameters
Returns
Rgbout
Example
import { linearToSrgbInto } from '@pbroom/color-kit';
const rgb = { r: 0, g: 0, b: 0, alpha: 1 };
linearToSrgbInto(rgb, { r: 1, g: 0.2, b: 0, alpha: 1 });
rgb; // → { r: 255, g: 124, b: 0, alpha: 1 }