RGB / HSL Colour Conversion

Converts between additive RGB (screens) and perceptual HSL (hue, saturation, lightness) for design tools. HSL from max/min RGB; L=(max+min)/2, S, H from dominant channel.

Method

Normalize hue modulo 360 and specify percentage saturation/lightness and RGB channel ranges. CSS HSL refers to sRGB; HSL lightness is not physical luminance.

Limitations

Device-dependent; colour management needs profiles. Normalize hue modulo 360 and specify percentage saturation/lightness and RGB channel ranges. CSS HSL refers to sRGB; HSL lightness is not physical luminance.

Example

Red RGB(255,0,0) -> HSL(0,100%,50%).

Editorial clarification

Normalize hue modulo 360 and specify percentage saturation/lightness and RGB channel ranges. CSS HSL refers to sRGB; HSL lightness is not physical luminance.

Sources

Educational reference only, not professional advice.

All algorithms