Welcome

If you’re feeling lost or are new to web accessibility, the following articles will help contextualize the content within this article:

  1. What is the AODA?
  2. Introduction to Web Accessibility
  3. WCAG 2.0 At a Glance
  4. Introduction to Writing and Formatting Content
  5. Writing Content
  6. Formatting Content

The information on this page has been written with web content creators in mind. In some cases, where we’ve determined that it’s important for you to understand how something works, more advanced guidelines have been included so you can make informed accessibility choices during content creation.

Who does these guidelines help?

  • Users with colour blindness.
  • Users with partial sight.
  • Users with limited colour, monochrome, or text-only displays.

Use of Colour

  • Principle 1. Perceivable: Information and user interface components must be presentable to users in ways they can perceive.
  • Guideline 1.4 Distinguishable: Make it easier for users to see and hear content including separating foreground from background.
  • Criterion 1.4.1 Use of Colour: Colour should not be used as the only visual means of conveying information, indicating an action, prompting a response, or distinguishing a visual element. If the colour of a page element is used to indicate information, that same information should also be conveyed in another way.

Example Scenarios for Use of Colour

The below table demonstrates typical failures of the Use of Colour Criterion, along with a suggested fix to meet the criterion. There may be other methods of sufficiently achieving this criterion. Detailed information, as well as other techniques, can be found on the WCAG Use of Colour Criterion page.

Example 1:
Incorrect

Hyperlinks are indicated with colour only.

A picture of a text which reads: The quick brown fox jumps over the lazy dog. The words 'quick brown fox' are blue.
Correct

Hyperlinks are indicated with colour as well as an underline.

A picture of text which reads: The quick brown fox jumps over the lazy dog. The words 'quick brown fox' are blue and underlined.
Example 2:
Incorrect

A required field in a form is only indicated by a colour change.

A form field for Name. The text input has a red border.
Correct

A required field in a form is indicated by the words Required as well as a colour change.

A form field for Name. The word (Required) is the colour red and is next to the field label.
Example 3:
Incorrect

A conference schedule contains dates and times for sessions. Each cell is colour coded: green cells indicate an open session, and orange cells indicate that registration is required.

An example of an incorrectly formatted table. Long description is below.
Long description of image: a table with 5 sessions scheduled from 10 a.m. to 2 p.m. Sessions that require registration are coloured orange. Sessions that do not require registration are coloured green.
Correct

In addition to being colour-coded, each cell should contain text that says, “Registration is not required” or “Registration is required”.

An example of a correctly formatted table. Long description is below.
Long description of image: a table with 5 sessions scheduled from 10 a.m. to 2 p.m. Sessions that require registration are coloured orange and include text that says registration is required. Sessions that do not require registration are coloured green and include text that says registration is not required.
Example 4:
Incorrect

A map showing a subway system has the routes included in different colours, with a legend using the same colours to identify the route name.

An example of an incorrectly formatted subway diagram. Long description is below.
Long description of image: a diagram showing 4 subway routes: Baker's Line in green, Brewer's Line in purple, Fisherman's Line in blue, Queen's Line in red.
Correct

Stops on individual routes are indicated with symbols as well as colours. The same symbol is included in the legend for that route, along with the colour.

An example of a correctly formatted subway diagram. Long description is below.
Long description of image: a diagram showing 4 subway routes: Baker's Line in green with a bread icon, Brewer's Line in purple with a beer mug icon, Fisherman's Line in blue with a fish icon, Queen's Line in red with a crown icon.
Example 5:
Incorrect

When navigating a website using your keyboard (by hitting tab), buttons that come into focus only change colour.

2 buttons. 1 button is light green. The other button has a dashed line indicating it's focused and is yellow.
Correct

Add a distinct visual change to the link when it is focused. For example, on focus you could add or remove an underline, add, or remove a border, or add or remove an icon.

2 button. 1 button is light green. The other button has a dashed line and underlined text indicating it's focused and is yellow.
Example 6:
Incorrect

An image of 3 types of pens is included on a webpage. The rollerball pen has an X drawn over it in red.

The alternative text for the image says, “We sell 3 types of pens: pen with cap, twist pen, rollerball pen. Pens with a red X are sold out.”

Correct

The alternative text for the image should say, “We sell 3 types of pens: pen with cap, twist pen, rollerball pen. Twist pens are sold out.”

Colour Contrast

  • Principle 1. Perceivable: Information and user interface components must be presentable to users in ways they can perceive.
  • Guideline 1.4 Distinguishable: Make it easier for users to see and hear content including separating foreground from background.
  • Criterion 1.4.3 Contrast: The criterion is outlined below.

The visual presentation of text and images of text must have a contrast ratio of at least 4.5:1, except for large text and logos. Large text must have a contrast ratio of at least 3:1.

Contrast refers to the colour contrast between foreground text colour and background colour. This includes text on a coloured background, as well as text that is laid over top of a background image.

The best way to meet colour contrast requirements is to use the WebAIM Contrast Checker tool. The tool allows you to enter your foreground and background colour and check whether the contrast passes or fails. Remember, our goal is to meet level AA contrast requirements. The tool allows you to use a colour wheel to select a colour, or you can you include the hex colour code.

Text on Images

For text on images, it might be difficult to determine if sufficient colour contrast is present because you will be comparing the foreground text colour against an image with (possibly) many background colours. Our recommendation is to sample the lightest or darkest colour in the image in the area below your text — whichever is opposite of the colour of your text — and use this as the background colour within the Contrast Checker tool. In some cases, determining sufficient colour contrast may be up to your discretion. Remember: if you find the text difficult to read, others will as well.

Images of text are discouraged based on the Images of Text 1.4.5 criterion. The below examples of images of text were produced specifically for this article, however in application, text on images should be added programmatically (ex. through a Content Management System text overlay feature).

Example Scenarios for Colour Contrast

Example 1:
Incorrect

The contrast in the below text example does not meet WCAG requirements.

Text which reads: the quick brown fox jumps over the lazy dog.
Correct

The contrast in the below text example WCAG requirements. Darkening the background colour makes the white text legible.

Text which reads: the quick brown fox jumps over the lazy dog.
Example 2:
Incorrect

The contrast in the below image example does not meet WCAG requirements. The text at the top of the image is not legible.

A cat sitting in grass. Text overlay reads 'the quick brown fox jumped over the lazy dog'.
Correct

The contrast in the below image example meets WCAG requirements. A block of colour has been placed below the text to increase contrast.

A cat sitting in grass. Text overlay reads 'the quick brown fox jumped over the lazy dog'.
Correct (Alternative Example)
A ginger cat with a bowtie. Text overlay reads 'the quick brown fox jumped over the lazy dog'.

Another method of solving contrast issues in images would be to choose images that have large blank areas of solid colour. Text of sufficient contrast can be added in these areas.

Tip: Keep in mind that text — when added programmatically — may shift around on different sized monitors. Be sure to shrink and expand the width of your browser window to see how the text reacts.

How do I get the hex colour codes that I need for contrast checker tools?

Use a browser plugin:

The easiest way to retrieve a colour code is to use a plugin like ColorZilla. ColorZilla allows you to use an eyedropper to select any colour on any webpage that you visit.

Use an online tool:

If you need to grab a colour from an image there are many online tools can be used. We suggest the RedKetchup Color Picker.

Use Adobe Photoshop:
An eyedropper icon

If you have access to it, the eyedropper tool in Adobe Photoshop can be used to select a colour.

Two colour cards: green and yellow. A mouse cursor is selecting the green card.

Once you have selected the colour, double click on the colour cards at the bottom of the toolbar.

An input box with hex code #e5f5e6

The hex colour code will be available at the bottom of the window.

Ask a web designer:

A web designer or developer will be able to provide you with any hex colour codes that you need.

Credits

  • Photo by Anna Shvets from Pexels
  • Photo by Lina Kivaka from Pexels
  • Photo by Kirsten Bühne from Pexels

References

W3C. (n.d.-b). Understanding Success Criterion 1.4.1: Use of Color. WCAG 2.1. Retrieved January 23, 2022, from https://www.w3.org/WAI/WCAG21/Understanding/use-of-color.html

W3C. (n.d.-c). Understanding Success Criterion 1.4.3 | Understanding WCAG 2.0. WCAG 2.1. Retrieved January 23, 2022, from https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html

Is this page useful?

Hidden
Hidden
Back to Top