Sub topic 8
Complementary colours: opposites on the wheel
This chapter assumes you can describe a colour by hue, saturation, and lightness (HSL), and that you have seen a colour wheel with hues arranged in a circle. It covers complementary colours: what they are, how to compute them, and where they go wrong.
What a complement is
Two colours are complementary when they sit directly opposite each other on the colour wheel. On a 360-degree HSL wheel, that means their hues differ by 180 degrees. Blue at 210 degrees pairs with orange at 30 degrees, because (210 + 180) mod 360 = 30.
Opposite hues give the strongest hue contrast a two-colour palette can have. Placed side by side, each colour makes the other look more intense. This is why a blue-and-orange movie poster feels vivid.
The complement depends on the wheel
The 180-degree rule holds on every wheel, but the wheels do not agree on which colours are opposite.
| Wheel | Complement of red | Complement of blue |
|---|---|---|
| RYB (traditional painting wheel) | Green | Orange |
| RGB (screens, and the HSL wheel built on it) | Cyan | Yellow |
On the RYB wheel, red and green are opposites. On the RGB wheel, red (0 degrees) is opposite cyan (180 degrees). Screen code uses the RGB-based wheel, so a CSS calculation gives the RGB complement. If you want painterly pairs such as red and green, you need an RYB wheel or a lookup table.
Computing a complement in CSS
CSS can do the rotation with calc(). Store the base hue in a custom property, then add 180.
:root {
--base-hue: 210;
}
.base {
background: hsl(var(--base-hue) 65% 45%);
}
.complement {
background: hsl(calc(var(--base-hue) + 180) 65% 45%);
}Browsers treat hue angles as wrapping around, so a result such as 390 is read as 30. Changing --base-hue moves both colours together, so the pair stays complementary.
Common errors
- Using full saturation on both colours. Two saturated opposites placed next to each other can seem to vibrate at the edge, and large areas of both tire the eye. Lower the saturation of one colour, or use a tint or shade of it.
- Giving both colours equal area. A complementary scheme reads best when one colour dominates and the other is an accent. The 60-30-10 guideline, covered later, helps here.
- Putting text in one colour on the other. Opposite hues can have similar lightness, so blue text on orange may be hard to read even though the hues contrast strongly. Hue contrast is not lightness contrast. Check contrast ratios separately.
- Assuming one wheel. Mixing an RYB complement from a design book with an RGB calculation in code gives pairs that do not match.
When to use it
Choose a complementary scheme when you want one clear point of emphasis, such as a button, a highlight, or a focal image against a calm background. Choose a different harmony when you want a quiet or unified mood.
Exercise
A base colour has hue 300 degrees. What is its complementary hue on the HSL wheel, and why must you apply a wrap-around step?
Show answer
The complement is (300 + 180) mod 360 = 120 degrees. Without the wrap, you get 480, which is outside the 0 to 359 range. Many tools accept it, but a calculation that compares or stores hues needs the modulo step to keep the value valid.
Exercise
A designer says red and green are complements, but your CSS calculation on a red base of hue 0 gives hue 180. Explain the difference.
Show answer
The designer is using the RYB wheel, where green is opposite red. CSS uses the RGB-based HSL wheel, where hue 180 is cyan. Both are correct for their own wheel, so pick the wheel that matches your medium.