Sub topic 1
Describing a colour: hue, saturation, and lightness
Prerequisites
This chapter assumes you can name common colours and have used a colour picker in a design or image-editing tool. You do not need any code experience to follow the ideas. The short CSS example at the end is easy to read without one.
Three attributes that describe any colour
A colour picker often shows a square and a slider. Those controls adjust three attributes. Together they describe almost any colour you can see on a screen.
- Hue is the basic colour family, such as red, green, or blue. It is measured as an angle from 0 to 359 degrees around the colour wheel. Red is at 0, green is near 120, and blue is near 240.
- Saturation is how intense or pure the colour is. It runs from 0% to 100%. At 0% the colour is a grey. At 100% it is as vivid as it can be.
- Lightness is how light or dark the colour is. It runs from 0% to 100%. At 0% the result is black. At 100% it is white. A pure colour sits near 50%.
This system is called HSL, after the first letters of the three attributes. Designers like it because each attribute changes one visible quality at a time.
Changing one attribute at a time
Take a blue with hue 210, saturation 65%, and lightness 45%. You can change it in three different ways.
| Change | Result |
|---|---|
| Hue 210 to 120 | The colour becomes green. Intensity and brightness stay the same. |
| Saturation 65% to 10% | The blue fades toward grey. |
| Lightness 45% to 85% | The blue becomes a pale sky blue. |
The first change moves the colour to a new place on the wheel. The other two keep the hue and change how the colour looks. This difference is the basis for the rest of the tutorial. Colour harmonies are rules about hue. Saturation and lightness then set the mood and the readability of the palette.
Hue is an angle
Hue wraps around. Hue 360 is the same as hue 0, so 350 and 10 are close neighbours, only 20 degrees apart. Keep this in mind when you do arithmetic on hues. Adding 180 to a hue of 210 gives 390, which wraps to 30. The code chapter later in this tutorial shows how to handle the wrap.
Seeing it in CSS
CSS can write a colour directly as hue, saturation, and lightness.
.swatch-a {
background: hsl(210 65% 45%);
}
.swatch-b {
background: hsl(210 20% 45%);
}
.swatch-c {
background: hsl(210 65% 80%);
}All three swatches share hue 210. The second has less saturation, so it looks dull and greyish. The third has more lightness, so it looks pale.
Common mistakes
- Treating hue as a "how much" value. Hue is a position on a circle, so a larger number is not a stronger colour.
- Expecting saturation 100% to look best. Fully saturated colours are often harsh, especially in large areas.
- Assuming lightness 50% always means a mid-tone. It does so for pure hues, but the eye still sees yellow as brighter than blue.
Exercise
A colour is hsl(0 80% 50%). You change only the saturation to 0%. What do you get, and what happens to the hue value?
Show answer
You get a mid grey. The hue value is still 0, but at 0% saturation it has no visible effect, because a grey has no colour family.
Exercise
Which single attribute would you change to turn hsl(120 60% 40%) into a clearly different colour family, such as blue, while keeping it equally intense and dark?
Show answer
Change the hue, for example to about 240. Saturation and lightness stay at 60% and 40%.