liveBook · Manning

Relative luminance

As explained in Everyday Data Visualization

Relative luminance is a normalized measure of the light emitted or reflected by a color relative to a reference white.

Relative luminance measures a color’s lightness relative to a reference white. It supplies the two values needed to calculate contrast between foreground and background colors. section 4.4.2

Use relative luminance to make visual elements easier to distinguish:

  • Calculate contrast as (L1 + 0.05) / (L2 + 0.05), using the lighter and darker relative-luminance values. section 4.4.2
  • Check small-scale color against its background at 4.5:1 for AA, or 7:1 for AAA. section 4.4.2
  • Check large-scale color at 3:1 for AA, or 4.5:1 for AAA; borders can change which color is evaluated. section 4.4.2

Blue bars on light gray

Blue bars without borders reach only 1.93:1 against light gray. Adding a dark-gray border produces an 8.7:1 border-to-background contrast, passing the 3:1 AA threshold. section 4.4.2

Figure 4.34 On the left, the blue bars have no border, so the contrast is calculated between the blue and the light gray as 1.93:1, which is too low to pass WCAG’s AA level of 3:1. However, if you add a dark-gray border, the contrast is then calculated using the border against the background, which shows up better than just the plain blue bars. The contrast between the darker gray border and the lighter gray background is a whopping 8.7:1, beating out the AA level by almost a factor of two.
04-34

Compare how adding a border changes the evaluated contrast and improves the visual separation of data bars. section 4.4.2

How Everyday Data Visualization covers it

How deep it goes
Defines the contrast formula and thresholds, but defers luminance mathematics to external calculators.
Examples
Uses blue bars on light gray, comparing 1.93:1 without a border against 8.7:1 with a dark-gray border.
What it assumes
Assumes foreground-background color comparisons and introduces the lighter-versus-darker luminance formula from zero.
What you can do after
Apply it via an accessible-colors calculator to evaluate foreground-background contrast and adjust visual elements.
How it connects
Connects relative luminance to contrast ratio, WCAG, color accessibility, and data visualization borders.

Also explained in

Compare how 2 books explain relative luminance →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Everyday Data Visualization. The section links point to the parts of the book it draws on.