×

css · level 3 · unit 7 · lesson 4

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

Text needs enough contrast to read, in every theme.

Pale grey on white looks stylish and is hard to read, for tired eyes, bright sunshine or low vision. measures the gap in lightness between two colours: 1 to 1 is no difference, 21 to 1 is black on white.

, the international rules for accessible websites, asks for at least 4.5 to 1 for normal text, and 3 to 1 for large text, icons and the edges of controls such as focus rings.

In a design system you check each text token against each surface token once, in every theme. Then every component built from those pairs passes too.

<p class="muted">Posted 2 hours ago</p>
<p class="body">Your parcel is on its way.</p>
:root {
  --text: #1f2937;
  --text-muted: #6b7280;
}
.body {
  color: var(--text);
}
.muted {
  color: var(--text-muted);
}

Press show my page to see it here.