linearToSrgb
Convert linear-light RGB (0-1) to 8-bit sRGB (0-255) with the sRGB transfer function. Each channel is rounded to an integer and clipped to [0, 255].
import { linearToSrgb } from '@pbroom/color-kit';srgb.ts:110function linearToSrgb( linear: LinearRgb,): Rgb;Parameters
Returns
RgbA new Rgb with integer channels
Example
import { linearToSrgb } from '@pbroom/color-kit';
linearToSrgb({ r: 1, g: 0.2, b: 0, alpha: 1 }); // → { r: 255, g: 124, b: 0, alpha: 1 }
linearToSrgb({ r: 1.2, g: 0.5, b: -0.1, alpha: 1 }); // → { r: 255, g: 188, b: 0, alpha: 1 }