Data dashboards lean hard on colour to encode meaning — green for up, red for down, blue for neutral. But 8 percent of men have some form of colour vision deficiency, and a pure red-green encoding is invisible to them.
Start with luminance
If two colours that encode different meanings have the same luminance, they are indistinguishable in greyscale. The first test: convert your palette to greyscale and check that every meaningful pair is still distinct.
function luminance(r, g, b) {
const [rs, gs, bs] = [r, g, b].map(c => {
c /= 255;
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
});
return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
}
Double-encode
Never rely on colour alone. Add a secondary channel: an arrow icon for direction, a pattern fill for chart segments, or a text label:
.trend-up { color: var(--green); }
.trend-up::before { content: '▲ '; }
.trend-down { color: var(--red); }
.trend-down::before { content: '▼ '; }
A data-heavy dashboard like the one at https://wyns-onlinecasino.com that shows live metrics to a broad audience has to assume that some viewers will never see the colour difference — the icon and the number must carry the message on their own.
Contrast ratios
WCAG 2.1 AA requires 4.5:1 for normal text, 3:1 for large text. For coloured badges on coloured backgrounds, test both the foreground-background pair and the badge-surface pair.
Dark mode
Colours that pass contrast in light mode often fail in dark mode. Define separate token values per theme rather than inverting: hsl(142, 70%, 40%) on white becomes hsl(142, 60%, 65%) on dark grey.
Takeaway
Accessible colour is not a constraint — it is a design tool. Luminance-first, double-encoded, contrast-checked.
Top comments (0)