semmixcolor and perception

Luminance

Luminance is the only brightness measure you can measure with an instrument. It says how much light a surface emits or reflects toward the eye, taking into account that the eye responds differently to different wavelengths.

Definition

Luminance is measured in candelas per square meter (cd/m², informally "nits"). It is radiant power weighted by the eye's sensitivity curve V(λ), which peaks at 555 nm (see the model of the eye). The V(λ) curve is the ȳ(λ) function of CIE XYZ, so the Y component is luminance.

SourceLuminance
moonless night skyabout 0.0001 cd/m²
office monitor, whiteabout 100-300 cd/m²
HDR display, highlights1000 cd/m² and more
white paper in sunlightabout 10,000-30,000 cd/m²

Relative luminance

Color work rarely needs luminance in cd/m². Relative luminance is usually enough: Y in 0..1 or 0..100, where 1 (or 100) is white. For sRGB it is computed from the linear components:

Y = 0.2126 · R_lin + 0.7152 · G_lin + 0.0722 · B_lin R_lin, G_lin, B_lin: components with gamma removed (see CIE XYZ and RGB) for RGB (200, 80, 40): Y = 0.2126 · 0.5776 + 0.7152 · 0.0802 + 0.0722 · 0.0212 = 0.1817

Green contributes over 71% of luminance, red 21%, blue under 7%. That is why pure blue looks dark and pure green bright. The full conversion is on the CIE XYZ and RGB page.

Luminance versus luma

Television and image compression use a similar-looking formula, but on gamma-encoded values:

luma Y' = 0.299 R' + 0.587 G' + 0.114 B' (Rec. 601) luma Y' = 0.2126 R' + 0.7152 G' + 0.0722 B' (Rec. 709)

This is luma, written Y' with a prime. It is cheaper to compute, but it is not luminance: for saturated colors the two differ noticeably. For our color luma (Rec. 601) is 0.437 and luminance 0.182. More in the article on YUV and YIQ.

WCAG contrast

The WCAG accessibility guidelines judge text legibility by the ratio of the relative luminances of text and background:

contrast = (Y_lighter + 0.05) / (Y_darker + 0.05) our color on white: (1 + 0.05) / (0.1817 + 0.05) = 4.53 : 1 our color on black: (0.1817 + 0.05) / (0 + 0.05) = 4.63 : 1

WCAG level AA requires 4.5:1 for normal text and 3:1 for large text. This brick orange is just above the threshold on both white and black. A slightly lighter shade would no longer work for text on white.

The 0.05 constant approximates ambient flare on a screen. The WCAG 2 formula is criticized for poorly reflecting the contrast of light text on dark backgrounds. The newer APCA method computes contrast differently, but WCAG 2 remains the binding standard.