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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: