Sub topic 10
Using value contrast to build hierarchy and focus
This chapter assumes you know what hue, saturation, and value are, and that you have met HSV and HSL. It also assumes you can read short CSS and Python snippets. Here you will use value, the light-to-dark axis, as a tool for deciding what a viewer sees first, second, and last.
Why value does the heavy lifting
Viewers read value before they read hue. Your visual system detects edges and shapes mainly from differences in lightness. Color differences help with identification, but they are weaker at defining form. This is why a photograph still makes sense in black and white, and why a layout with the right value structure still works when the colors are wrong.
Designers use this fact in three ways:
- Hierarchy. The element with the strongest value difference from its surroundings is noticed first.
- Focus. A single dark or light shape against a quiet field pulls the eye to it.
- Legibility. Text is readable only if its value differs enough from its background.
Hue and saturation still matter for mood and brand. They are the wrong tools for deciding order of attention, because two colors of different hues can sit at the same value and visually vibrate against each other without either one winning.
Value contrast defined
Value contrast is the difference in lightness between two adjacent areas. It is usually described in three bands:
| Contrast level | Value gap (rough, on a 0–100 scale) | Typical effect | Typical use |
|---|---|---|---|
| Low | under 20 | Calm, soft, quiet | Backgrounds, panels, disabled states |
| Medium | 20 to 50 | Clear but gentle | Cards on a page, secondary text, dividers |
| High | over 50 | Sharp, urgent, dominant | Primary headline, main action button |
These numbers are rules of thumb, not standards. The point is that you choose a gap on purpose. If everything has high contrast, nothing stands out. If everything has low contrast, nothing can be read.
The squint test
You can check value structure without any tool. Squint at the design until the details blur, or apply a blur or grayscale filter. What remains is the value structure. Ask:
- Which element is the first to stand out?
- Is that the element you intended?
- Can you still tell the major regions apart?
If the answer to question 1 is a decorative element, your hierarchy is inverted. Fix it by changing value, not by making the important element larger or more colorful.
Building hierarchy with a value ladder
A practical method is to assign each layer of an interface a rung on a value ladder. Take a light theme, where the page is near white:
- Page background: very light (L around 98%).
- Card surface: slightly different (L around 100%, or 94% with a border).
- Secondary text: mid-dark (L around 40%).
- Primary text: very dark (L around 12%).
- Primary action: the most saturated, darkest solid area on the page.
The primary action gets the largest value gap from its surroundings. Secondary elements get a medium gap. Background layers get a small gap. The viewer's eye then travels from largest gap to smallest.
The CSS below keeps one hue and builds the ladder only by changing lightness.
:root {
--hue: 215;
--page: hsl(var(--hue) 20% 98%);
--surface: hsl(var(--hue) 20% 94%);
--border: hsl(var(--hue) 15% 82%);
--text-secondary: hsl(var(--hue) 15% 40%);
--text-primary: hsl(var(--hue) 25% 12%);
--action: hsl(var(--hue) 85% 32%);
--action-text: hsl(var(--hue) 20% 98%);
}
body {
background: var(--page);
color: var(--text-primary);
font-family: system-ui, sans-serif;
}
.card {
background: var(--surface);
border: 1px solid var(--border);
padding: 1.5rem;
border-radius: 0.5rem;
max-width: 24rem;
}
.card p {
color: var(--text-secondary);
}
.card button {
background: var(--action);
color: var(--action-text);
border: 0;
padding: 0.6rem 1.2rem;
border-radius: 0.375rem;
font-weight: 600;
}Every color shares hue 215. Nothing in the hierarchy depends on hue, so the design survives grayscale printing and most forms of color vision deficiency.
Focus: one strong contrast against a quiet field
Focus works by scarcity. A design can carry many low and medium gaps, but only one or two high gaps. The element that owns the highest gap becomes the focal point.
Three common patterns:
- Dark on light. A single dark button or headline on a pale page.
- Light on dark. A bright element on a dark interface. In dark themes the logic reverses: the brightest element is the focal point.
- Spotlight. A dimmed overlay (a modal backdrop at roughly 50% black) lowers the value of everything behind a dialog, so the dialog's lighter surface gains contrast by comparison.
Measuring value in code
You can estimate the value gap numerically. HSV value is the maximum of the three RGB channels, which is simple but, as a later chapter explains, a poor match for perceived lightness. HSL lightness is the midpoint of the highest and lowest channels. For hierarchy checks, a better proxy is luma, a weighted sum of the channels that reflects how bright each primary appears.
def luma(r, g, b):
"""Approximate perceived brightness. Inputs are 0-255 integers."""
return 0.2126 * r + 0.7152 * g + 0.0722 * b
def value_gap(color_a, color_b):
"""Gap between two colors on a 0-100 scale."""
return abs(luma(*color_a) - luma(*color_b)) / 255 * 100
page = (247, 249, 251)
secondary_text = (87, 98, 112)
primary_text = (15, 22, 38)
action = (12, 62, 150)
for name, color in [("secondary text", secondary_text),
("primary text", primary_text),
("action", action)]:
print(f"{name:15s} gap from page: {value_gap(page, color):5.1f}")Running this prints a growing set of gaps, with the primary text showing the largest. Notice that the action color has a hue and saturation that look strong but a luma gap smaller than the primary text's. That is why the action works as a shape and the text works as the reading layer: they win attention in different ways.
Luma here uses the weights for linear-light-style brightness applied directly to gamma-encoded values. This is a rough tool for sorting colors into low, medium, and high gaps, not a precise measurement.
Edge cases and common errors
Equal value, different hue. Red text on a green background of the same lightness is hard to read and appears to shimmer. If you need two hues side by side, separate them by value as well.
Saturated colors fake their value. A fully saturated yellow (hsl 60 100% 50%) has a high perceived brightness, while a fully saturated blue at the same HSL lightness looks much darker. If you build a ladder from HSL lightness alone, yellow elements will jump forward and blue elements will recede. Check the result with the squint test, not only the numbers.
Too many focal points. If five elements each have a high gap, the viewer's eye bounces between them. Reduce all but one or two to medium gaps.
Contrast that is too low for the job. A low gap works for a background layer but fails for text. Meeting a reading standard is a separate, stricter check, covered in the chapter on contrast ratios.
Dark mode copied by inversion. Flipping lightness values (L becomes 100 minus L) does not preserve hierarchy. Pure white text on near black can glare, and the elevated surfaces in dark themes are usually lighter than the page, the opposite of a drop shadow cue. Tune the ladder again rather than inverting it.
Borders doing value's job. A heavy border can fake separation, but it adds visual noise. A small value shift between page and surface usually separates regions more cleanly.
A short workflow
- List the elements on the screen and rank them by importance.
- Choose a base hue and assign each rank a lightness, with the largest gap for rank one.
- Keep saturation low on background layers and higher on the focal element.
- Blur or desaturate the design and confirm the order of attention matches your ranking.
- Adjust any element that wins attention it should not have, using value first.
Exercise
A pricing page has three plan cards. The middle plan should be the recommended one, but in a grayscale preview all three cards look equally prominent. Describe two changes that use value contrast to make the middle card the focal point, and say what you would check afterward.
Show answer
Make the middle card's surface or its button the highest-gap element. For example, give its call-to-action button a dark fill (L around 30%) with light text, while the other two plans use outlined or pale buttons at a medium gap. Alternatively, give the middle card a darker header band or a slightly different surface value from the other two, and lower the contrast of the side cards' secondary elements. Afterward, run the squint test or a grayscale filter to confirm the middle card is noticed first, and check that text on every card still has enough contrast to be readable.
Exercise
In the Python example, why is the luma gap a better proxy for hierarchy than comparing HSV value directly? Give a case where HSV value would mislead you.
Show answer
HSV value is just the largest RGB channel, so it ignores how bright each channel looks to the eye. Pure blue (0, 0, 255) and pure yellow (255, 255, 0) both have HSV value 100%, yet yellow looks far lighter than blue. Luma weights green most and blue least, so it gives yellow about 93 and blue about 7 on the 0 to 255 scale, which matches what you see. Comparing HSV value would wrongly treat the two as equal in lightness.