toRgbInto
Convert a Color to sRGB (0-255, rounded and clamped like toRgb), writing into out (allocation-free).
import { toRgbInto } from '@pbroom/color-kit';into.ts:140function toRgbInto( out: Rgb, , color: Color,): Rgb;Parameters
Returns
Rgbout
Example
import { parse, toRgbInto } from '@pbroom/color-kit';
const rgb = { r: 0, g: 0, b: 0, alpha: 1 };
toRgbInto(rgb, parse('oklch(0.7 0.15 30)'));
rgb; // → { r: 237, g: 118, b: 101, alpha: 1 }