@pbroom/color-kitConversion

hslToRgb

Convert HSL (hue in degrees, saturation and lightness 0-100) to 8-bit sRGB (0-255, each channel rounded to an integer). Any finite hue is accepted and wrapped.

functionimport { hslToRgb } from '@pbroom/color-kit';hsl.ts:114
function hslToRgb(hsl: Hsl): Rgb;

Parameters

hslHsl
HSL color

Returns

RgbA new Rgb with integer channels

Example

TypeScript
import { hslToRgb } from '@pbroom/color-kit';

hslToRgb({ h: 200, s: 80, l: 40, alpha: 1 }); // → { r: 20, g: 129, b: 184, alpha: 1 }

See also