HSL colour space


Martin McBride, 2021-04-28
Tags colour hsl hsb
Categories computer science colour
In Computer science

The HSL colour space (and the closely related HSV space) store colours as 3 values:

  • The Hue (H) indicates the basic colour, essentially the position of the colour on the colour wheel that goes from red to green to blue then back to red.
  • The Saturation (S) controls how saturated the colour is. A value of 100% indicates a pure colour, 50% represents the same colour but mixed with grey, and at 0% the colour is pure grey.
  • The Lightness (L) controls how light or dark the colour is. Lightness of 50% shows the basic colour at a medium level of lightness. If the L component increases towards 100%, the colour gets lighter and lighter until it eventually becomes white. If the L component decreases towards 0%. the colour gets darker and darker until it eventually becomes black.

This diagram shows the colour wheel of hue values. The hue can be expressed as an angle between 0 and 360 degrees, where 0 degrees is red, 120 degrees is green, and 240 degrees is blue:

Here is the effect of changing the saturation between 0% and 100% (with a hue of green and lightness of 50%). Notice that the basic colour remains the same:

Finally, here is the effect of changing the lightness between 0% and 100% (with a hue of green and saturation of 50%). Again, the basic colour remains the same:

HSL colours are useful in art and design applications, because they allow sets of related colours to be created very easily.

HSL variants

The HSB (hue, saturation, brightness) colour space uses the same definition of hue as HSL. Saturation and brightness behave differently, but can achieve the same range of colours as HSL.

The HSL model works well with the additive model (as used by RGB). HSB is based on a subtractive colour model, but generally CMYK is more useful for subtractive colours. HSB tends not to be used as often as HSL, so we will not cover it in detail.

You may also see the term HSV (hue, saturation, value). This is an alternative name for HSB.

If you found this article useful, you might be interested in the book Computer Graphics in Python or other books by the same author.