liveBook · Manning

WCAG

As explained in Math for Web Design

The Web Content Accessibility Guidelines (WCAG) are an international standard for making web content accessible to people with disabilities.

WCAG makes readable web text measurable: calculate the contrast ratio between foreground and background colors instead of relying on visual judgment. section 7.4

Choose the applicable minimum ratio:

  • Normal text below 18px needs 4.5:1 for AA or 7:1 for AAA. section 7.4.1
  • Large text at least 18px, or bold text at least 14px, needs 3:1 for AA or 4.5:1 for AAA. section 7.4.1
  • Compute contrast as CR = (L1 + 0.05) / (L2 + 0.05), using the lighter luminance first; results range from 1:1 to 21:1. section 7.4.2

To obtain luminance, normalize sRGB channels to 0–1, linearize each with the piecewise gamma formula, then calculate L = 0.2126Rᵢ + 0.7152Gᵢ + 0.0722Bᵢ. The weighting reflects greater sensitivity to green than blue. section 7.4.3

Blue text on white

Pure blue (#0000FF) has relative luminance 0.0722. Against white with luminance 1, the contrast ratio is 8.59:1, exceeding the AAA threshold for normal text. section 7.4.3 section 7.4.1

CR = (1 + 0.05) / (0.0722 + 0.05) = 1.05 / 0.1222 = 8.59

Verify the blue-on-white result by evaluating the contrast formula with the two luminance values. section 7.4.3

How Math for Web Design covers it

How deep it goes
Explains AA and AAA thresholds, contrast-ratio arithmetic, sRGB linearization, and weighted luminance calculation.
Examples
Uses light gray on white, black on white, gray thresholds, and pure blue on white as contrast examples.
What you can do after
Evaluate color pairs with luminance and contrast formulas, then apply the result to CSS or JavaScript.
How it connects
Connects color contrast with relative luminance, sRGB, CSS, JavaScript, and web accessibility.

Also explained in

Compare how 3 books explain WCAG →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Math for Web Design. The section links point to the parts of the book it draws on.