Research: Counting Every Accessible Color Combination
For about fifteen years I’ve wondered how many accessible color combos there are. Not a rough estimate, but exact counts.
It turns out that Rust is extremely fast at exactly this type of calculation. And using a threadripper 3990x with 64 cores, it seemed feasible to brute-force calculate this across 2 algorithms (WCAG, APCA) and 3 thresholds for each of them. After 39 hours I had some hard data.
Total possible hex code pairs: ~281 trillion (16,777,216² / 2)
| Threshold | Passing Pairs | % of All Pairs |
|---|---|---|
| APCA 60 | 20.6 T (20,637,683,557,008) | 7.33% |
| APCA 75 | 4.4 T (4,405,913,610,605) | 1.57% |
| APCA 90 | 239 B (239,182,492,850) | 0.08% |
| WCAG 3.0 | 74.6 T (74,553,266,253,058) | 26.49% |
| WCAG 4.5 | 33.7 T (33,723,177,965,830) | 11.98% |
| WCAG 7.0 | 10.2 T (10,236,606,051,802) | 3.64% |
- WCAG’s ratio is symmetric (text on background = background on text)
- APCA is polarity-aware (light text on dark ≠ dark text on light) — which is why the numbers differ
- APCA better models actual readability, but constrains the palette more
I’m still working on processing all of the output with some more in-depth visual analysis to add here later.