Sub topic 10
Using value contrast to build hierarchy and focus
This chapter assumes you know hue, saturation, and value from the earlier chapters. It also assumes you can read short CSS and Python snippets. Here you will use value, meaning how light or dark a color is, to decide what the viewer sees first.
Why value does the heavy lifting
Value contrast is the difference in lightness between two colors that sit next to each other. The eye reads it faster than it reads a difference in hue. A bright red button and a bright green button of equal lightness can look like they have the same importance. A near-white button on a near-black panel stands out immediately.
Designers use this to set hierarchy, which is the order in which a viewer notices things. The element with the highest value contrast against its surroundings is seen first. Elements with lower contrast recede.
The squint test
A quick way to judge value contrast is to blur your design or squint at it. Hue and saturation fade, and you see only light and dark shapes. If the element you care about disappears, its value contrast is too low. If everything stays equally prominent, the hierarchy is flat.
You can do the same check in code by converting a color to grayscale. The Python example below uses the colorsys module and a simple lightness estimate.
import colorsys
def value_of(r, g, b):
"""Return the HSV value (0 to 1) of an RGB color."""
return colorsys.rgb_to_hsv(r, g, b)[2]
background = (0.10, 0.10, 0.15) # dark navy
headline = (0.95, 0.95, 0.90) # near white
caption = (0.45, 0.45, 0.50) # mid gray
for name, color in [("headline", headline), ("caption", caption)]:
gap = value_of(*color) - value_of(*background)
print(name, round(gap, 2))The headline has a much larger value gap from the background than the caption does. That gap is what makes it the first thing a reader sees.
Three levels of emphasis
A simple scheme uses three value levels for text and interface elements on one background.
- Primary: the highest value contrast. Use it for headlines and the main action.
- Secondary: medium contrast. Use it for body text and supporting labels.
- Tertiary: low contrast. Use it for hints, dividers, and disabled states.
:root {
--bg: hsl(220 25% 10%);
--text-primary: hsl(220 15% 95%);
--text-secondary: hsl(220 12% 70%);
--text-tertiary: hsl(220 10% 45%);
}
body { background: var(--bg); color: var(--text-secondary); }
h1 { color: var(--text-primary); }
.hint { color: var(--text-tertiary); }All three text colors share one hue, 220. Only lightness changes, so the page stays cohesive while the hierarchy is clear.
Creating a focal point
To make one element a focal point, give it the strongest value contrast on the page and keep its surroundings closer together in value. A single light card on a mid-dark layout draws the eye. If several elements all have strong contrast, they compete and the focal point is lost.
Color can add to this but should not carry it alone. A saturated accent hue helps, yet the element still needs a clear value difference. Otherwise it fails the squint test and is hard to see for people with color vision deficiency.
Common errors
- Low contrast for style: pale gray text on white looks refined but is hard to read. Check it against the contrast ratios covered in a later chapter.
- Equal value across hues: a red and a green with the same lightness vibrate against each other and blur together in grayscale.
- Too many highlights: if everything is emphasized, nothing is.
- Trusting numeric value alone: equal HSV value does not mean equal perceived lightness. A later chapter explains why.
Exercise
A page has a dark background with a headline, body text, and a footnote. All three use the same hue. Which one should have the lowest value contrast against the background, and why?
Show answer
The footnote. It is the least important item, so it gets the lowest contrast and recedes. The headline gets the highest contrast so it is seen first, and the body text sits in between.