Using CSS filter to test colour contrast

Low vision is a common visual impairment needing to be considered when testing a site for accessibility. There are many excellent tools available to help with this but if you just want a quick test to give you a good idea while you are developing locally, I have found this snippet really handy:

body {
  filter: grayscale( 100% );

All this does is applies the greyscale filter to every element on the page. Once applied, you can then scan down the page and if there is any text that is not clear or easy to read, then you know that someone with low vision would struggle to read it and you need to increase the contrast ratio. Easy! 🙂

Here’s an example with some pretty garish colour combinations and what they look like in greyscale.