Colour and contrast - what does it mean?

A presentation at Inclusive Design & Accessibility Meetup in March 2019 in Rotterdam, Netherlands by Erik Kroes

Slide 1

Slide 1

Colour and contrast What does it mean?

Slide 2

Slide 2

A double rainbow

Slide 3

Slide 3

Let’s talk about me first. Erik Kroes

Slide 4

Slide 4

• Photographer • Visual Artist • Creative Coder • Accessibility Specialist • Front End Developer • Online Fabric Store Owner

Slide 5

Slide 5

Colour and contrast. A short recap

Slide 6

Slide 6

Text has a contrast ratio of at least 4.5:1. Except large text, that should be at least 3.0:1

Slide 7

Slide 7

Screenshots of color contrast analyzer, contrast-ratio.com and the color contrast tool inside chrome developer tools

Slide 8

Slide 8

But let’s go back a step. My fabric store

Slide 9

Slide 9

Pippi Longstockings opening a cupboard with piles of cloths coming out.

Slide 10

Slide 10

It’s a mess. Wordpress, woocommerce, a theme, a child theme, lots of extensions and two versions of bootstrap.

Slide 11

Slide 11

Open electric wires covered by a paper umbrella

Slide 12

Slide 12

Clean this up the right. Start with a color palette, easy

Slide 13

Slide 13

Nyan cat

Slide 14

Slide 14

An accessible color palette

Slide 15

Slide 15

A guy surrounded by complicated looking math

Slide 16

Slide 16

One does not simply pick a colour. How many colour spaces are there?

Slide 17

Slide 17

Which colour space does WCAG use?

Slide 18

Slide 18

Dr. Evil saying “How about no!”

Slide 19

Slide 19

HSL sounds good But it’s not

Slide 20

Slide 20

A blue and a yellow panel with the same saturation and luminance. Hue: 240° Saturation: 100% Luminance: 50% Hue: 60° Saturation: 100% Luminance: 50%

Slide 21

Slide 21

3 shades of red with the same hue and saturation but different lightness.

Slide 22

Slide 22

A rainbow of colors with the same hue and saturation but different lightness. The contrast ratio’s vary wildly.

Slide 23

Slide 23

So where does it come from? ITU-R Recommendation BT.709

Slide 24

Slide 24

Michael Scott from the Office looking tired and saying: Why don’t you explain this to me like I’m 5?

Slide 25

Slide 25

• It is a television standard • It has the same color coverage as sRGB • It has a component called Luma • It is a way to measure brightness in sRGB that takes the human eye in account

Slide 26

Slide 26

John Travolta in Pulp Fiction, not knowing what to do

Slide 27

Slide 27

It’s not the Luma that matters. It’s what you do with it

Slide 28

Slide 28

It’s a contrast ratio. Black on white is 21:1

Slide 29

Slide 29

• Black is 21 times as dark as white • White is 21 times as bright as black • The range we work with is always 21

Slide 30

Slide 30

A color that is 3.0:1 on white. 21 / 3… 7.0:1 on black

Slide 31

Slide 31

A color that is 4.5:1 on white. 21 / 4.5… 4.67:1 on black

Slide 32

Slide 32

Chris Pratt getting his mind blown

Slide 33

Slide 33

Only 3 shades fit with 3.0:1. 1:3:9

Slide 34

Slide 34

Only 3 shades fit with 4.5:1. 1:4.5:20.25

Slide 35

Slide 35

Only 2 shades fit with 7:1. 1:7

Slide 36

Slide 36

Where does that leave us?

Slide 37

Slide 37

A grid with shades of gray and their wcag contrast ratio’s

Slide 38

Slide 38

A grid with shades of teal and their wcag contrast ratio’s

Slide 39

Slide 39

I made a thing. https://github.com/erikkroes/color-tool

Slide 40

Slide 40

But my website is still a mess

Slide 41

Slide 41

• http://contrast-grid.eightshapes.com • http://bit.ly/a11y-color-palette • https://github.com/erikkroes/color-tool • https://twitter.com/erikkroes