This blog looks at how to make a website with accessible colour contrasts. It’s part of a series called Accessible Intentions, which is for people who want to do the right thing for accessibility, but aren’t sure how.
For more context and definitions of some terms I use here, read the introduction to the Accessibility Intentions series.
Cheat sheet: Just tell me what to do
If you just want to solve the issue of colour contrasts as simply as possible, you need to do two things:
- Make sure all colour contrasts on your website have a colour contrast ratio of at least WCAG 7:1. Never put text or graphics over gradient colours, videos or photographs.
- Check this using both light and dark mode. You can test this by turning on dark mode in your browser.
You can test your colour contrast ratio using the WebAim Contrast checker.
The rest of this blog explains this in more depth:
Why is it important to think about colour contrast?
The way you use colour on a website is important. It can be a big part of brand identity, and can help people navigate your site. However, it’s important that people who have barriers around vision can still access the content.
There are two groups of people primarily affected by your choices around colour:
Colour blind people: There are lots of different types of colour blindness, so different people will struggle with different kinds of colours. Just under 1 in 20 people who access your website are likely to be colour blind.
Sight impaired people: Although people who are completely blind will probably be using a screen reader, people with some vision might still be looking at your site, probably using a magnified view.
Both of these groups will struggle if the colours on your site are hard to distinguish.
What does WCAG say about colour contrast?
The contrast between the colour used for text, or a graphic, and the background colour must be enough for the text to be readable. You can measure this by looking at the contrast ratio of the colour hex codes.
For WCAG AA compliance (‘silver’)
For AA WCAG compliance, your content needs to have contrast ratios of at least:
- 4.5:1 between the background colour and between small text
- 3:1 between the background colour and large text or graphics
Reference: WCAG 1.4.3: Contrast – minimum
For WCAG AAA compliance (gold standard)
For AAA, your content needs to have contrast ratios of at least:
- 7:1 between the background colour and between small text
- 4.5:1 between the background colour and large text or graphics
Reference: WCAG 1.4.6: Contrast – minimum
What counts as ‘small text’?
The problem is that WCAG doesn’t officially define what ‘small’ or ‘large’ text is, and this will be different for every person visiting your site so it’s safest to aim for the large text standards. That’s why I find it safest to aim for at least 4.5:1 for all content, or 7:1 if you want to go for gold (AAA).
Exceptions
Technically, decorative elements aren’t subject to contrasting rules, and neither are logos.
So these elements might not fail WCAG, but that doesn’t mean people can suddenly see them properly.
If you’re using someone else’s logo on your site, then you’ll need to use it according to their brand guidelines. Make sure it has proper alt text and surrounding information, particularly if the contrasts are poor.
If it’s your own logo, then I’d really recommend using accessible colour contrasts. Then more people will be able to see it, and recognise and trust you.
My post on alt text gives more detail about when something is ‘decorative’.
Where it gets complicated
Text over images and videos
The guidance in WCAG assumes a site uses solid colours. When you have text over an image or video, things get more complicated. It’s easiest to avoid this, but if you really want text over an image or video, then a good solution is to use a semi transparent background to the text portion.
You should also always make sure that a video can be paused – I’ll be adding a full blog about pausing videos.
Colour gradients and patterns
A colour gradient is when lots of different colours mix together, instead of a solid colour block.

Again, this is best avoided. It’s harder to read text against an uneven background, even if the contrast is ok. But if you do use a gradient or pattern, check the contrast of the darkest and lightest colours against the text colour. If both are fine, then the contrast is ok.
Free testing tools
The WAVE evaluation tool is a free plugin that will highlight inaccessible colour contrasts on a specific web page.
You can also test the contrast between 2 colours using the WebAim Contrast checker. This will tell you the contrast ratio, and highlight where it meets WCAG standards.
You can check perceived luminance using APCA contrast checker.
Always make sure you test your colour contrasts with in both dark and light mode. The best way to do this is to change your browser settings. In most browsers, you can do this through Settings – Appearance.
Contact me
If you have feedback on this post, or want help with anything else to do with accessible and inclusive content, get in touch via email or social media.