Colour Contrast Checker · Tutorial
How to fix white text that’s hard to read on a button
5 min readbeginnerUpdated
Your orange buttons with white text look bright and friendly, but an accessibility review flagged them. This tutorial checks the pair, explains the result, and finds the closest orange that keeps white text readable.
What you need
- The Colour Contrast Checker
- Your button and text colours, or the sample from the Try it button
Steps
Enter the two colours
Put the text colour in the first field and the button colour in the second. The sample is white text,
#ffffff, on an orange button,#f28c28.Read the result
The ratio is 2.45:1. Normal text needs 4.5:1, and even large text and icons need 3:1, so every level fails. Light, warm colours like orange and yellow are bright, so white text has little contrast against them.
Pick a suggested button colour
Under Nearest colours that pass, find Background colour for 4.5:1:
#b36100, a deeper orange with the same hue. Click it: the background field updates and the preview shows white text that is clearly easier to read.Or keep the colour and change the text
If the bright orange is essential to your brand, try dark text instead. Swap the colours or set the text to a dark grey; dark text on this orange passes AA easily.
Update your CSS
Use the new colour for the button and its hover state. Check the hover colour too, since it often gets lighter.
.button { background: #b36100; /* the checker’s suggestion for 4.5:1 */ color: #ffffff; }
Try it yourself
Opens the Colour Contrast Checker with this tutorial's sample loaded.
Common mistakes
- Checking only the default state
- Hover, focus and disabled states have their own colours. Check each pairing.
- Relying on bold text
- Bold text only counts as large from 18.66 pixels upward. A bold 16-pixel button label still needs 4.5:1.
- Rounding up
- 4.45:1 does not pass 4.5:1. The checker shows the ratio cut, never rounded up, so a passing badge is always a real pass.
Next steps
Go back to the Colour Contrast Checker, or keep going with one of these:
FAQ
Does disabled button text need to pass?
WCAG makes an exception for disabled controls, but low contrast still makes them hard to read. Keep it reasonable.
Which is better, darker button or darker text?
Either works. Choose the option that stays closest to your brand and looks consistent across the site.