Skip to main content

Images, illustrations, and contrast

Posted in Accessibility and Design

Adding descriptive text to images is a great way to ensure people who can’t see the screen understand what the image is communicating. Unsurprisingly there’s a success criterion in the Web Content Accessibility Guidelines (WCAG) to ensure we add descriptive text: 1.1.1 Non-text Content, but what about people with low vision who can see the screen but need a decent amount of contrast to distinguish shapes and lines easily?

There are a couple of success criteria in WCAG that cover contrast, if you’re aiming for AA compliance:

Text contrast is straightforward enough, but non-text contrast is trickier. 1.4.11 requires a 3 to 1 contrast ratio for certain non-text elements, including images (which count as “Graphical Objects”), and it talks specifically about:

Parts of graphics required to understand the content

So an image can contain elements that don’t provide enough contrast, as long as without those parts it still conveys the same meaning.

How to check if an image has enough contrast

We need to understand how an image would look to someone with a visual impairment who needs a decent amount of contrast. To do this we need to remove the parts of the image that don’t have enough contrast (that 3 to 1 ratio) with their immediate surroundings.

To identify the bits of an image that might be problematic, a colour picker tool or contrast analyser plugin for your drawing tool (Figma, Sketch, and the rest) comes in handy. Checking contrast can be time consuming at first, but you should soon develop a good feel for low contrast elements; then the tools are just there to check your intuition.

Once we know which bits of the image are too-low contrast, we need to decide if the image still makes sense without them. There are a few ways of doing this:

  • For vector images like an illustration, remove/hide the shapes that don’t meet at least a 3 to 1 contrast ratio against their immediate surroundings
  • For raster images like a photo, use the colour fill tool to make the low contrast bits the same colour as their surroundings; messy but effective
  • Use a filter to increase the contrast of the image, usually to as high as it will go, and problematic objects will usually both turn black or white
  • Use your imagination (again, this comes with practice)

If the image still makes sense without the bits you’ve removed, you’re in good shape.

Which images should comply?

Not all images need to provide enough contrast. The rule of thumb here is that if an image has descriptive (alt) text, it should meet the Non-text Contrast requirement. Not sure which images should have descriptive text? I’ve written an article that should help with that!

Accessibility in your inbox

I send an accessibility-centric newsletter on the last day of every month, containing:

  • A roundup of the articles I’ve posted
  • A hot pick from my archives
  • Some interesting posts from around the web

I don’t collect any data on when, where or if people open the emails I send them. Your email will only be used to send you newsletters and will never be passed on. You can unsubscribe at any time.

More posts

Here are a couple more posts for you to enjoy. If that’s not enough, have a look at the full list.

  1. Images as the first thing in a button or link

    If the text of an interactive element like a button or link is preceded with an accessible image, we’ve probably got an accessibility problem.

  2. Alt text for CSS generated content

    There’s an interesting feature in Safari 17.4 that allows content added with CSS to have ‘alt’ text. I’m not sure how I feel about this.