HSL To RGB
Reverse Conversion
How This Converter Works
Converts HSL hue and percentage saturation/lightness to rounded 8-bit RGB channels; optional alpha can produce rgba output.
Formula or rule
C=(1-|2L-1|)S; X=C(1-|((H/60 mod 2)-1)|); m=L-C/2. Select the hue sector, add m, multiply channels by 255, and round.
Example
- Input
- HSL 0, 100, 50
- Calculation
- S=1, L=0.5, C=1, X=0, m=0. The 0° sector yields channels (1,0,0)×255.
- Result
- rgb(255, 0, 0)