+ All Categories
Home > Documents > WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have...

WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have...

Date post: 10-Jul-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
72
Understanding and Evaluating WCAG Contrast Requirements Jonathan Whiting WebAIM.org
Transcript
Page 1: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Understanding and Evaluating WCAG Contrast Requirements

Jonathan WhitingWebAIM.org

Page 2: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Overview

WCAG Requirements• 1.4.3 – Text contrast • 1.4.11 – Non-text contrast

(WCAG 2.1) • 1.4.1 – Use of Color

Evaluate• WebAIM Contrast Checker• WAVE• Colorzilla color picker• Chrome DevTools• Colour Contrast Analyser• WebAIM Link Checker

See webaim.org/articles/contrast/evaluating for details

Page 3: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Low-contrast Text

“I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’ So they make it prettier by using a really tiny font with very low contrast. If you’re a 20-year-old programmer, you can read it, but an 83-year-old grouch like me can’t.” Don Norman

Page 4: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Color contrast

Page 5: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Color contrast

Page 6: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Color contrast

Page 7: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Color Luminance contrast

Page 8: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Relative luminance contrast

Page 9: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Relative Luminance

Pure red is hard to readPure green is even worsePure blue is pretty good

Page 10: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Relative Luminance

Page 11: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

WCAG Contrast Formula

(L1 + 0.05) / (L2 + 0.05)where

L = 0.2126 * R + 0.7152 * G + 0.0722 * Bwhere

R, G, and B =RsRGB <= 0.03928 then R = RsRGB/12.92

else R = ((RsRGB+0.055)/1.055) ^ 2.4where

RsRGB < = R8bit/255

Page 12: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Contrast ratio

Page 13: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’
Page 14: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Level AA Contrast Examples4.5:1

Gray (#767676) on White

Purple (#CC21CC) on White

Red (#F30000) on Yellow (#FFFF00)

3:1 – “Large” text

≥18pt (24px)

BOLD: ≥14pt (18.67px)

Page 15: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

WebAIM Contrast Checker

webaim.org/resources/contrastchecker/

Page 16: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

“Images of text”

Page 17: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Exceptions

Page 18: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

“Incidental”

Page 19: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’
Page 20: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

“Not visible to anyone”

Page 21: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

“Logotypes”

Page 22: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Test contrast in WAVE

wave.webaim.org

Page 23: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

“Background color is the specified color of contentover which the text is to be rendered in normal usage”

Page 24: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Gradients and background images

Page 25: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

“For text displayed over gradients and background images, authors should ensure that sufficient contrast exists for each

part of each character in the content.”

Page 26: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Gradients and background images

Page 27: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

For text displayed over gradients and backgroundimages, authors should ensure that sufficient contrast exists for

each part of each character in the content.

Page 28: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’
Page 29: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

We have the same contrast ratio

Page 30: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Outline/Halo Together?

Page 31: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

3:1 Outline/Background

Page 32: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

3:1 Halo/Text

Page 33: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

1:1 Outline/Halo!

Page 34: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’
Page 35: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’
Page 36: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Colorzilla

colorzilla.com

Page 37: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

1.4.11: Non-text Contrast (WCAG 2.1)

• Level AA• No Level AAA

• 3:1 contrast of:• User Interface Components

• Including states (focus indicators, hover states, etc.) • Graphical Objects

Page 38: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

UI “Boundaries”

I have read and agree to the Terms of Use

Page 39: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

…except when “determined by user agent”

Page 40: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

You break it you buy it

Page 41: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

UI “States”

I have read and agree to the Terms of Use

Page 42: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Default Keyboard focus outline

Page 43: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Chrome Developer Tools

Page 44: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Practice – Chrome DevTools

1. Go to twitter.com2. Check contrast of the “Log In” button3. Check its contrast with a hover state4. Bonus – Find an element that can’t be tested with DevTools

See webaim.org/articles/contrast/devtools for help

Page 45: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

“Graphical Objects”

Page 46: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

“Required to understand”

Facebook

Page 47: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’
Page 48: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’
Page 49: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’
Page 50: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

“Against adjacent color(s)"

Page 51: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Exception – “Essential”

Page 52: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Twitter logo in site?

Page 53: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Non-HTML content

Page 54: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Representing Colors

• RGB• Red, green, blue (e.g., 118, 118, 118)• Can be displayed as HEX (e.g., #767676)

• HSL• Hue, saturation, lightness (e.g., 0, 0%, 46%)• Lightness ≈ Luminance

• Alpha• AKA transparency/opacity• RGBA (118, 118, 118,.75) would have 2.9:1 contrast

Page 56: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

1.4.1 Use of Color – Level A

Page 57: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

“Conveying information”

•Amanita•Chanterelle•Porcini•Shiitake•Tylopilus

Page 58: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

“Conveying information”

•Amanita•Chanterelle•Porcini•Shiitake•Tylopilus

AmanitaChanterellePorciniShiitakeTylopilus

Page 59: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Separate lists

Edible• Chanterelle• Porcini• Shiitake

Poisonous• Amanita• Tylopilus

Page 60: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

“Prompting a response”

Page 61: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

*

*

Page 62: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’
Page 63: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

1. Ensure sufficient contrast2. Do not rely on color alone

Page 64: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Example – Contrast vs. Color use

Page 65: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Requirements for color-reliant links

1. A 3:1 contrast ratio between link text and non-link text2. An “additional visual cue” (typically underline) on mouse

hover AND keyboard focus

Page 66: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’
Page 67: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’
Page 68: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’
Page 69: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’
Page 70: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’
Page 71: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

WebAIM Link Contrast Checker

webaim.org/resources/linkcontrastchecker/

Page 72: WCAG Contrast and Color - TechAccess Ok...Low-contrast Text “I simply can’t read them. They have been taken over by graphic designers who say ‘text is ugly and gets in the way.’

Thank you!

Jonathan Whiting@jonwhiting


Recommended