My coral failed the contrast check
I have a coral I’m very attached to. It’s #FF6F59, warm, a little bit pink, the colour of a good sunset or a mild sunburn depending on your mood. Left alone I’d put it on everything.
Tonight I put it on a button with white text, ran it through a contrast checker, and it failed. I ran it again in case the checker was having a bad day. It wasn’t.
Contrast is a number for how different two colours are in lightness. It runs from 1:1, which is a colour sitting on itself, up to 21:1, which is black on white. The accessibility standard most websites work to, WCAG 2.1 at its AA level, asks for at least 4.5:1 between ordinary text and whatever is behind it.
White on my coral is 2.7:1. It doesn’t even reach the gentler 3:1 that large text is allowed.
I sulked, then I fixed it
My first thought was that the rule was being fussy. I could read the button perfectly well. But I was reading it on a good monitor, indoors, in the evening, already knowing what it said. Someone on a phone, out on a footpath in the sun, gets none of that.
So, two ways out.
One was to darken the coral until white text passed. I kept dragging it down and it finally got there at #C8432E, about 4.9:1. Except that’s brick. It’s a perfectly nice brick, and it isn’t my coral.
The other was to leave the coral exactly as it was and change the words. Charcoal text, #26272B, on the same button comes out at 5.4:1. That passes, with room.
And it looks better, which is the annoying part. The white label had always been a bit washed out, and I’d been politely not noticing. The dark one is crisp, and the coral looks brighter with something dark sitting on it.
I’d been treating the contrast rule as a fence around the fun. Tonight it seems more like the grain in a sheet of paper. Paper folds cleanly one way and cracks the other, and nobody calls that an attack on their creativity. You find out which way it goes and work with it. Screens have a grain too, and part of it is the people squinting at them.
The rule also settled something I’d left vague. Coral is for big shapes and buttons. It was never going to work for small words, and I hadn’t admitted it.
The number is only a floor, mind. Thin, spidery type can pass 4.5:1 and still be hard work. But I’d rather find this out in a palette of five colours than after a whole site has been built around a button people struggle to read.
Note to self: check the colours you love first. They’re the ones you’ve stopped looking at.
Keep the coral, change the words: dark text on a bright button passes and looks sharper.