Problem solved in full
-
Contrast ratio between #e2e6f0 text and a #1a1d27 background 5 steps
Work out the contrast ratio between #e2e6f0 text and a #1a1d27 background — this page's own colours. Averaging the channels gives 5.55. WCAG gives 13.46. Find out where the factor of two and a half comes from.
-
The definition looks harmless: a ratio of two luminances, each nudged by 0.05 so that pure black does not divide by zero. The weights are not equal, and that is the first surprise — green is credited with ten times more luminance than blue.
-
The second surprise is that the channel values cannot be used as they are. A byte in an image file is gamma-encoded: 128 does not mean half the light, it means roughly a fifth of it. The piecewise expression undoes that encoding, and it is the step that everyone who rolls their own contrast check omits.
-
Run both colours through it. The light one lands at 0.79, the dark one at 0.0124 — a factor of 63 apart in physical light, from bytes that are only a factor of about 7 apart.
-
The 0.05 offsets then compress that 63 down to 13.46, which is the number the panel shows. That offset is not cosmetic: it models the light your screen reflects even when displaying black, which is why a dark theme cannot achieve unbounded contrast in a lit room.
-
The weights explain a designer's most common complaint. Pure green and pure blue are both a single channel at full strength, yet green carries 0.7152 of the luminance and blue only 0.0722.
Answer
The tool prints 13.46 : 1, comfortably past AA's 4.5 and AAA's 7. The reason to work it by hand is the gamma step: skip it, average the channels instead, and this pair scores 5.55 — still a pass, but wrong by a factor of 2.4, and on a closer pair that error is the difference between a pass and a failure. The weights are the other half. Green is 9.9 times brighter than blue at the same channel value, so blue text on black is far worse than it looks in a colour picker, and yellow on white far better than designers expect. Try #0000ff against #000000 and read the ratio.
-
References (2)
- The contrast formula and the 0.03928 threshold block 3 is about: W3C, Web Content Accessibility Guidelines (WCAG) 2.1, "relative luminance" and "contrast ratio" definitions.
- The sRGB transfer function it should have matched: IEC 61966-2-1:1999, Multimedia systems and equipment — Colour measurement and management — Part 2-1: Default RGB colour space — sRGB, which puts the linear/gamma switch at 0.04045.