hslToRgb
Converts an HSL(A) color into RGB(A).
Available since v3.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
color | HslColor | The color to convert. `h` is normalized modulo 360 (negative values wrap around), `s`/`l` are expected in 0-100, `a` defaults to 1 (opaque) when omitted. |
Returns
Section titled “Returns”RgbColor — The equivalent RGB(A) color, with r/g/b rounded to 0-255
Examples
Section titled “Examples”Convert an HSL color to RGB
Section titled “Convert an HSL color to RGB”Useful after generating a hue programmatically (e.g. evenly spaced chart colors).
Hue wraps around 360 degrees
Section titled “Hue wraps around 360 degrees”Negative or out-of-range hues are normalized before conversion.
Related Types
Section titled “Related Types”HslColor
Section titled “HslColor”An HSL(A) color with channels expressed as plain numbers.
RgbColor
Section titled “RgbColor”An RGB(A) color with channels expressed as plain numbers, convenient for further conversion or manipulation.
