Sub topic 9
Complementary, analogous, and triadic harmonies
This chapter assumes you know what hue, saturation, and value are, and that you can read a hue angle on the color wheel (0° red, 120° green, 240° blue). It also assumes you can read short CSS and Python snippets. A color harmony is a rule for choosing several hues that look good together. The rule works on hue alone. Saturation and value are set separately, and that split is where most mistakes happen.
Harmonies are angle arithmetic
On a hue wheel, every harmony is a base hue plus a fixed set of offsets. The offsets are measured in degrees and wrap around at 360.
| Harmony | Offsets from base | Hues for a base of 210° | Feel |
|---|---|---|---|
| Complementary | 180° | 210°, 30° | High tension, strong contrast |
| Analogous | -30°, +30° | 180°, 210°, 240° | Calm, cohesive |
| Triadic | 120°, 240° | 210°, 330°, 90° | Lively, balanced |
| Split-complementary | 150°, 210° | 210°, 0°, 60° | Contrast with less tension |
Wrapping uses modulo arithmetic. For a base of 300° and an offset of +120°, the result is 420° minus 360°, which is 60°.
Complementary: two hues, maximum contrast
A complementary pair sits directly opposite on the wheel: blue and orange, red and green, purple and yellow. Placed side by side, each hue makes the other look more intense.
Use this pair when you need one clear point of emphasis. A blue interface with a single orange button is the standard example. The design works because the pair is used unevenly.
- Give the dominant hue most of the area, around 80 to 90 percent.
- Give the opposite hue only to elements that must stand out, such as a call to action or a key data series.
- Avoid full-saturation complements at equal area. Red text on a green background, or the reverse, vibrates at the edges and is hard to read.
Be careful with the word "opposite". The wheel behind HSV and HSL is the RGB wheel, which is not the same as the traditional painter's red-yellow-blue wheel. On the RGB wheel the complement of red (0°) is cyan (180°). On the painter's wheel it is green. Both are valid. Choose one wheel and use it consistently within a project. Screen design usually uses the RGB wheel.
Analogous: neighbors that share a family
An analogous scheme uses hues within about 30° to 60° of each other, for example blue-green, blue, and blue-violet. The hues share most of their light, so the result looks unified, like a landscape at dusk.
The weakness is that nothing stands out. Analogous schemes tend to look flat unless you create variety in other ways:
- Vary value across the three hues. Make one dark, one mid, and one light.
- Vary saturation, with one vivid accent and two quieter supporting colors.
- Add a neutral, such as a near-white or a near-black tinted toward the base hue.
A common approach is to pick one hue as dominant, one as supporting, and one as an accent. That is better than giving all three equal weight.
Triadic: three evenly spaced hues
A triad uses three hues 120° apart. Red, green, and blue is the extreme case, and at full saturation it looks like a toy. Triads are easier to use at lower saturation, or with one dominant hue and two accents.
Triads give more variety than analogous schemes and less tension than complements. Use them for illustrations, charts with three categories, and playful brands. When all three hues carry the same saturation and value, the scheme looks busy. As with complements, assign roles. One hue is the base, one is secondary, and one is used sparingly.
Computing harmonies in code
The Python function below rotates the hue and leaves saturation and value alone. Keep this in mind, because it shows the main limitation of harmonies: the same angle math is applied to every color, whatever its brightness.
import colorsys
def rotate(rgb, degrees):
"""Rotate the hue of an RGB color (0-1 floats) by a number of degrees."""
h, s, v = colorsys.rgb_to_hsv(*rgb)
return colorsys.hsv_to_rgb((h + degrees / 360) % 1.0, s, v)
def to_hex(rgb):
return "#{:02x}{:02x}{:02x}".format(*(round(c * 255) for c in rgb))
SCHEMES = {
"complementary": [180],
"analogous": [-30, 30],
"triadic": [120, 240],
"split-complementary": [150, 210],
}
base = (0.2, 0.4, 0.8) # a medium blue, hue 220 degrees
for name, offsets in SCHEMES.items():
colors = [to_hex(base)] + [to_hex(rotate(base, d)) for d in offsets]
print(name, colors)The first entry in every list is the base color, #3366cc. For the complementary scheme, the second entry is #cc9933, a warm gold. Python's % operator returns a non-negative result for a positive divisor, so the -30° offset wraps correctly with no special handling.
The same idea works in CSS. Store the hue in a custom property and derive the other hues with calc():
:root {
--base-hue: 210;
--primary: hsl(var(--base-hue) 70% 45%);
--accent-complement: hsl(calc(var(--base-hue) + 180) 80% 50%);
--analogous-a: hsl(calc(var(--base-hue) - 30) 60% 50%);
--analogous-b: hsl(calc(var(--base-hue) + 30) 60% 50%);
--triad-a: hsl(calc(var(--base-hue) + 120) 55% 50%);
--triad-b: hsl(calc(var(--base-hue) + 240) 55% 50%);
}Changing --base-hue now moves the whole scheme and preserves the harmony. CSS accepts hue values outside 0 to 360 and wraps them, so 210 + 240 = 450 is read as 90°.
Why mathematically correct harmonies can still look wrong
Hue offsets guarantee the relationship between hues. They do not guarantee that the colors look equally bright or equally strong. Three problems come up often.
- Uneven perceived lightness. In HSL and HSV, yellow at 60° with 50% lightness looks much brighter than blue at 240° with the same lightness. A rotated palette may therefore have one color that jumps forward. Adjust lightness by eye for each hue, or compare the colors in a perceptual model such as OKLCH.
- Uneven hue spacing. The 120° triad on the HSV wheel is not perceptually even. The greens occupy a large span and the blues and purples a small one. A "triadic" scheme can feel lopsided.
- Contrast failure. A complement of the same value as the base can be nearly unreadable as text on that base. Hue difference alone gives weak contrast. Value difference does the work.
Choosing a harmony
| Goal | Better choice | Reason |
|---|---|---|
| One clear call to action | Complementary or split-complementary | The accent hue is far from the base, so it stands out |
| Calm, readable interface or editorial layout | Analogous plus a neutral | Hues blend and lightness steps create structure |
| Three data categories | Triadic at moderate saturation | Hues are evenly separated and easy to tell apart |
| Brand with a strong, playful feel | Triadic with one dominant hue | Variety without equal weight on all three colors |
| Needing text on a colored background | Any harmony, with a large value gap | Legibility depends on value contrast, not hue |
Two edge cases are worth knowing. First, a base color with very low saturation, such as a gray with a faint blue tint, has an almost meaningless hue, so rotating it produces swatches that look nearly identical. Raise saturation before applying a harmony. Second, harmonies on grays or on pure black and white have no effect at all, because hue is undefined at zero saturation.
Exercise
Your brand color is hsl(20 70% 50%). Give the hue of its complement, the two analogous hues at ±30°, and the two triadic hues. Then say which harmony you would choose for a page that needs one standout button on a calm layout.
Show answer
Complement: 20 + 180 = 200°. Analogous: 20 - 30 = -10, which wraps to 350°, and 20 + 30 = 50°. Triadic: 20 + 120 = 140° and 20 + 240 = 260°. For a calm layout with one standout button, use the analogous hues (or the base with a neutral) for the page, and use the complement at 200° only for the button. Keep the button's area small so it stays the strongest point on the page.
Exercise
A Python function rotates the hue of #3366cc by 180°, and the resulting complement has the same HSV saturation and value as the original. Explain why putting text in one of these two colors on a background of the other could still be hard to read.
Show answer
Rotating the hue changes only the hue, so saturation and value stay the same. Colors with the same value often have similar perceived lightness, so the contrast ratio between them can be low even though the hues are far apart. Legibility depends on a difference in lightness, so you would need to make one color clearly lighter or darker.