Optimization

How can the contrast ratio have an impact on SEO?

APCA and AA/AAA contrast ratio standards

Web accessibility is one of the important on-page SEO signals that may be less valued. “Contrast ratio” is an accessibility subset that provides readability on the texts for all people, even those with color recognition or some vision problems. In this article, you can find detailed information about contrast ratio on the web.

In this article:

A brief history of the contrast ratio

It is interesting to know that Isaac Newton calculated the contrast ratio of 7 colors in 1704, and designed a color circle for them. Based on this color circle, every two colors which were positioned opposite each other, had the highest contrast ratio. Later in 1708 Johann Goethe, the well-known German writer, created another color circle with 6 colors included, but he did not use mathematical calculations like what Isaac Newton had done.

Newton color circle
Newton color circle
Von Goethe Farbkreis color circle
Von Goethe Farbkreis color circle

Why is the contrast ratio important?

Based on the statistics, about 320 million people around the world, 1 man in a 20-male population and 1 woman in a 200-female population are suffering from color blindness and vision disabilities. So, it is essential to provide suitable conditions on the web pages for all to be able to read the content on websites. For this purpose, Google suggests considering the Web Content Accessibility Guidelines (WCAG) standards regarding accessibility and color contrast ratio.

How is the contrast ratio calculated?

One of the valid color contrast ratio standards was created by the World Wide Web Consortium (W3C) based on the WCAG. The color contrast ratio is calculated based on the level of background and foreground colors’ luminance. The white color has a luminance of 100% and the black color luminance is 0%.

contrast ratio = (L1 + 0.05) / (L2 + 0.05)
# L1 = Luminance 1 = Light color relative luminance level 
# L2 = Luminance 2 = dark color relative luminance level

The contrast ratio measure can be a number between 1 to 21 that is shown as  1:1 or 1:21 (or 21:1 based on the background and foreground dark or light color).

Contrast ratio with AA/AAA standard

According to the WCAG standard, the minimum number for the contrast ratio is 4.5 which is known as AA, and the ideal number is 7 as AAA. In the case that the font size is 120% to 150% bigger than the default font size, the contrast ratio will be decreased to 3 (AA) and 4.5 (AAA).

Different contrast ratio
Different contrast ratio

The color contrast ratio 4.5:1 (in minimum) is suitable for people with color recognition problems and the elderlies with the age of 80. This number for the person with a color blindness problem is 7:1 at minimum.

Text typeAAAAA
Text < 24px4.57
Text > 24px34.5
UI (icons, graphs, etc.)3N/A

Checking contrast ratio with AA/AAA standard in Google Chrome

In Google Chrome DevTools, it is possible to investigate the contrast ratio of the elements and find the issue. By heading over to the Elements tab, in the Styles section, select a color, so the color picker is opened. If the browser could have distinguished the background color based on the CSS, the contrast ratio level will appear in the color picker box. The passed contrast ratios (AA and AAA) are shown with single or double green check marks ✔ and the failed contrast ratio is presented with a forbidden sign🚫.

Checking contrast ratio based on AA/AAA standard in Google using Chrome DevTools color picker
Checking contrast ratio based on AA/AAA standard in Google using Chrome DevTools color picker

Contrast ratio measuring tools based on AA/AAA standard

There are online and offline different contrast ratio checker tools with which you can check if the contrast ratio of a color is passed or not. Here are our recommendations in case of checking your website or UI design accessibility and contrast ratio:

  1. Google Chrome DevTools (color picker)
  2. Accessibility Insights for Web Chrome extension
  3. A11y – Color Contrast Checker Figma plugin
  4. Contrast Figma plugin

Contrast ratio with APCA standard

Accessible Perceptual Contrast Algorithm (APCA) is another contrast ratio standard that is more accurate than AA/AAA. In addition to the font size and font weight, it considers the text role on the page as well. In the below, you can find the APCA contrast ratio table:

Font weight100200300400500600700800900
Font Size
10px©§™©§™©§™©§™
11px©§™©§™©§™©§™
12px©§™©§™x100x90x80
14px©§™100908060x60
16px10090806055x50x50
18px9080605550x40x40
24px100806055504038x35
30px9070555040383530
36px8060504038353025
48px10070554038353025>20
60px90605038353025>20>20
72px805540353025>20>20>20
96px7050353025>20>20>20>20
120px60403025>20>20>20>20>20

⊘: There should not be any text with this size or weight on a page, just decorative text is allowed.

©§™: There should not be text with this font weight or font size on the page’s content, but it can be used in other non-content usages like Copyright.

x: x-number like x100 means that font size or font weight should not be used in the body of a content on a page. They are better to be used for larger text elements like headlines, titles, or large elements.

<20: It is recommended not to use the text with the mentioned font weight and font size.

Measuring contrast ratio with APCA standard in Google Chrome

To use the APCA contrast ratio standard in Google Chrome, you need to first enable it by following the steps below:

  1. Open Google Chrome DevTools using Control+Shift+C or F12 on Windows, Linux, and Chrome OS, or Command+Option+C on macOS.
  2. Click on the settings icon⚙️on the top left side of the DevTools.
  3. Click on the Experiments on the left sidebar.
  4. Enable APCA as shown in the image below.
  5. Reload the DevTools for the new changes to be applied.
Checking contrast ratio based on APCA standard in Google using Chrome DevTools color picker
Checking contrast ratio based on APCA standard in Google using Chrome DevTools color picker

Now, reopen the DevTools and head over to the Elements tab. Click on a color to open the color picker. If the browser could have recognized the background color, then you can see the contrast ratio based on the APCA standard in the color picker.

Contrast ratio audit

As mentioned earlier, it is possible to check an element contrast ratio by using Google Chrome DevTools color picker and some extensions. Now, it is also possible to check the whole page colors’ contrast ratio at once and find the elements that do not pass the acceptable contrast ratio.

To investigate the whole page from a contrast ratio perspective, you can use DevTools and Lighthouse reports that are explained in the rest of the content.

Checking contrast ratio with Google Chrome CSS Overview

By using Google Chrome CSS Overview, you can check the whole page content contrast ratio. To enable this feature on your browser, you can follow the steps below:

  1. Open Google Chrome DevTools using Control+Shift+C or F12 on Windows, Linux, and Chrome OS, or Command+Option+C on macOS.
  2. In DevTools, open Command Palette using Control+Shift+P on Windows, Linux, and Chrome OS or Command+Shift+P on macOS.
  3. Write CSS and then select Show CSS Overview.
Adding CSS Overview option to Google Chrome DevTools
Enabling CSS Overview in the Google Chrome DevTools

On the CSS Overview tab, click on the “Capture overview” button. Based on the settings you chose as contrast ratio standard (AA/AAA or APCA), the result will be one of the images below:

Contrast ratio report in CSS Overview based on AA/AAA standard
Contrast ratio report in CSS Overview based on AA/AAA standard
Contrast ratio report in CSS Overview based on APCA standard
Contrast ratio report in CSS Overview based on APCA standard

Automatic contrast issue report in Google Chrome DevTools

In Google Chrome DevTools, there is another contrast ratio-related report that shows the contrast ratio issue on a page as a report. To enable this feature:

  1. Open the DevTools.
  2. Click on the Settings icon⚙️on the top right side.
  3. From the left sidebar, head over to the Experiments section.
  4. Enable automatic contrast issue report as shown in the image below
  5. Reload the DevTools so that the changes will be applied.
enabling automatic contrast ratio reporting in Google Chrome DevTools
enabling automatic contrast ratio reporting in Google Chrome DevTools

After reloading the DevTools, the number of contrast ratio issues on the top right of the DevTools will be shown if any contrast-related issue exists. By clicking on each issue, you can see the issue details.

Automatic contrast ratio report in Google Chrome DevTools
Automatic contrast ratio report in Google Chrome DevTools

Checking contrast ratio with Google Lighthouse

Google Lighthouse is a free open-source page auditing tool that investigates a page from performance, accessibility, SEO, and PWA aspects and suggests useful tips in the best practices section. By using Lighthouse, you can see probable contrast ratio reports and the elements in the accessibility part.

Google Lighthouse contrast ratio issue report
Google Lighthouse contrast ratio issue report

Color blindness emulation in Google Chrome DevTools

As mentioned earlier, nearly 5% of the world’s population is dealing with color blindness. Some of them cannot recognize any color, and the rest are not able to see a specific color spectrum like green, blue, or red. Fortunately in Google Chrome, there is the possibility to emulate color blindness. You can enable this feature by the following steps:

  1. Open Google Chrome DevTools.
  2. Press Control+Shift+P keys on Windows, Linux, and Chrome OS or Command+Shift+P keys on macOS to open Command Palette.
  3. Type “render” and then select Show rendering.
  4. On the rendering tab, choose the desired option from Emulate vision deficiencies.
Emulate vision deficiencies in Google Chrome DevTools
Emulate vision deficiencies in Google Chrome DevTools

Summarize

Besides considering the harmony of colors while UI/UX designing, it is really important to care more about color contrast ratio which is a critical accessibility metric. Providing a better user experience with suitable website visibility from a design perspective for all people should be of high priority.

Leave a Reply

Your email address will not be published. Required fields are marked *