Contrast requirements for WCAG 2.2 Level AA

Posted:
Tagged with:

Introduction

We're going to take a deep dive into colour contrast here, where we will look into all three WCAG 2.2 success criteria (SC) that apply at Level AA:

We're looking at all three together as whilst Contrast (Minimum) and Non-text Contrast have no overlap, Use of Color can seemingly have a bit of overlap and perhaps cause a little confusion, I've definitely misunderstood and failed something against Non-text Contrast, when it should have been Use of Color, I mean, nobody ever pulled me up on it, it still failed WCAG, just not the SC I reported it against. Accuracy is paramount to reporting issues, there are definitely times where somebody will bitterly spend a considerable bit of time finding a way to discredit you, when it would have just been much quicker to fix the issue and we don't exist to get into arguments, we just want to make the web work for as many people as possible, so it's best to avoid giving folk ammo to discredit us.

In this guide there will be a lot of "This meets the requirement" type language, this isn't me advocating for something that just meets a specific requirement, but I have to state when something passes and when it doesn't. So, just to be clear that just scraping through the contrast checker for a specific thing is seldom a wise strategy. I'm going to include some "Best practice" type advice too, but as always, they won't be the definitive "Best practices" they'll just be much better than the bare minimum, and, as always, that's because there are often multiple ways of achieving something accessibly, but mostly because what works well for some users may not work as well for others.

WCAG thresholds

Before we start to discuss the individual SCs, we'll just take a moment to understand what WCAG means when it sets a threshold value. It's important to know and understand this as it performs part of the tests.

Some WCAG SCs may appear intentionally vague or the tests section in the Understanding Document may appear incomplete, this, I believe, is because websites can contain an unlimited number of technologies, components and patterns, some of which may not even have existed at the time the standard was last updated and as WCAG is "Technology agnostic" it covers a broad range of implementations and technologies.

The thresholds we are going to look at here are absolute, there is no confusion or ambiguity over the minimum values we are provided with, so from a testing perspective that makes life easier for us, as conformity is pretty easy to determine, so let's just summarise some of these values:

*I'm using pixels instead of points, I explain why, in the next section

In the Understanding Docs, which I linked to for each SC, at the start, often there will be reference to "Adjacent color(s)", which typically means the background of the the element in question, although, it can mean any feature that delineates the element from the internal or external background, such as borders and shadows, etc.

Text sizes

WCAG uses points for text sizing or pt in CSS, and in the understanding document they give us minimum thresholds in points, and then approximate the pixel values. This quote is taken from the understanding document for Contrast Minimum: "The ratio between sizes in points and CSS pixels is 1pt = 1.333px, therefore 14pt and 18pt are equivalent to approximately 18.5px and 24px". I'm unsure why they do not give the exact value for pixels, I mean 1.333 * 14 = 18.662 and not 18.5, so that is something to be aware of. Personally, I use 2 decimal places, so for me, 18.66px. Again, it would feel a bit pedantic to say "Hey, this text is only 18.65px and it needs to be 18.66px", but I have never personally encountered that. It's also worth pointing out that in WCAG a pixel is a unit of measurement, there are 96 pixels in an inch (a CSS inch). These are commonly known as CSS pixels on the web. These are not the same as hardware pixels, the hundreds of thousands or even millions of individual dots that form a display, MDN calls them Device pixels, so it is important not to think "Ahh, but 18.65px will be rounded up on my display", as there is a difference between CSS pixels and hardware pixels. We just care about the unit of measurement, we have no control over the users' displays. There may be several hardware pixels being used to display a single CSS pixel, high PPI (pixels per inch) such as Retina, 4K, 5K & 8K, etc displays do not map 1:1 from CSS pixels to hardware pixels.

The next section is going to be a bit of a primer which is aimed at folks that may not be too comfortable with the DevTools and getting CSS values, so if you wish to avoid the waffle and you know this stuff, you may wanna skip that bit.

Finding the correct size and weight values

CSS has tonnes of units for most aspects of the interface, we're not consigned to just using pixels, we can use "em", "rem", "vw", "mm", "cm", "inches", "px", "%" and loads more just for height and width alone, colours may use Hex, RGB, HSL and more.

For anyone not overly familiar with CSS, this may be useful to know as ultimately we want be able to determine values that are presented in a unit that makes it easier for us to determine whether the element in question passes of fails.

I do the bulk of my testing in the DevTools, I read a lot of CSS, HTML and ARIA, I look at values and I find all sorts of interesting stuff. I do also use assistive tech and semi-automated checkers, but I just do that later in my process, as that's what works for me, it's just the way I do it. Some folks will perhaps not open the DevTools unless they are running Axe, not everybody knows CSS, HTML and ARIA, so perhaps there is less of an emphasis on reading code and stuff for some folk? So, for these folks, this next tip may be useful to know, if you didn't already.

I primarily use Chrome (I know) during my initial reading the code phase, I'm a creature of habit I guess, and also it is the most popular browser. So I read the code in Chrome and then do more functional testing with AT, and a range of browsers and devices, etc. I tell you this as some of my jargon may appear Chrome-centric, so I apologise in advance if that's the case.

So, let's say we find some font that looks a little thin, low-ish contrast and it's not that large, whatever the reason, it's enough to make us suspicious enough to look into it. Generally, I'd open the DevTools (see, Chrome-centric) and take a look at the CSS in the Elements Panel, and I would locate the element in question to look at the values in the Styles pane.

I pondered how far I should go into the DevTools, Inspector, Developer Tools or whatever you call them in other browsers. I do not have a disability that effects my motility or sight, so I am able to visually locate something and then right click it, when I do this it opens the DevTools pretty much exactly where I want it. I'll be honest, I have no idea how to achieve the same with a keyboard, I don't think that exact behaviour is possible? I know I can open the DevTools with a keyboard, but when I use the keyboard shortcuts to do this it always opens on the <body> element which means you may have to trawl through <div> soup that is comparable in depth to the Mariana Trench, which, if that is the only way, is clearly rubbish. Using the search function in the DevTools may help, but for that you would of course need to know what the elements was called, so it would need a text label, this can be done with the regular "Find" shortcut CMD and F (Mac) or CTRL and F (Windows). Given that I have no control over how the DevTools opens or where it highlights a relevant node and I cannot find a way to replicate mouse behaviour on keyboard, I'm just going to skip over that bit, as I don't want to say "Right click on this button, choose 'inspect' and now look at the highlighted node in the DevTools", as that is obviously just catering for users that don't have a disability that prevents them from doing that. I will assume that everybody knows how to open the DevTools or Inspector, though.

Take our Home page, let's say for some reason we wanted to get the colour and size of the part of the heading that is purple "Make Things Accessible". Here's a screen shot of our Home page and the DevTools open:

Screen shot of Make Things Accessible Home page. the DevTools show the node with the text Make Things Accessible, is highlighted in the Elements pane

In the DevTools there is a lighter highlighted line indicating this is the node I have selected. Forget that our text is obviously accessible, we just want to check some values. In the adjacent panel the Styles Pane is selected and displayed. At the top of the Styles Pane there is information about the font-size of that text, which uses a class and an element child selector, like so: .main__title--home span, that gets us the <span> that contains the text "Make Things Accessible" and that text has the following CSS: font-size: 4.5rem; on my screen (it may be different on yours, depending on screen size or zoom level, etc). What is a rem, is it important? Nope, it's a relative unit, it could mean absolutely anything, if I so wanted to I could make 1px = 1rem or 1rem to be 200px, both of which would be a bit silly and make things more difficult to work with. So, as testers, we're not concerned with rems and to a lesser extent ems, etc. We are concerned only with absoloute units, such as px and perhaps pts. But for our purpose, we just want to check the pixel values and font-weight.

The primary reason I will die on the hill of px, is because that is what the Computed Values are presented in, I don't want to do math, converting stuff, I'm happy with working with pixels and that works best for me.

If, in the CSS panel we click the "Computed" tab (it's called this in Chrome, Safari and Firefox), we then get the values we want.

Annotated screen shot of the Make Things Accessible Home page, with the DevTools open. The annotations are arrows, which show the elements panel, the span node that contains the text, the Computed properties pane and finally the computed values for font size and weigh are highlighted.

In the above screen shot I've placed a series of arrows and boxes which outline key controls or information points, which in essence is Elements > the DOM node ( a <span>) > the Computed pane and finally the CSS properties and values for both font-size and font-weight. We have the values 72px for the font's size and 900 for the font's weight. Obviously both these values far exceed the minimum requirement for not only Level AA, but also Level AAA (we do try). But now we know the actual size and weight of the text that is presented in useful units, we know anything above 700 for weight is considered "Bold" and we also know 72px is larger than 24px, so we know this would only require a 3:1 contrast ratio against the background. If we wanted to check the contrast of that text, we could use Color Contrast Analyser (CCA) and get the text colour #7E2F9D and the background colour #F4F4F4 and CCA will tell us that the contrast is 6.9:1 in light mode. If you are following along in Dark Mode (I don't know why I'm not) the text colour #C2A7D7 and background colour #252525 gives us a contrast ratio of 7.2:1. Both of which easily exceed the requirements for Level AAA (4.5:1), due the the font size and weight.

Finding contrast values

There are dozens of ways to find the contrast of an element and its background, sometimes I'll use WebAIM's Contrast Checker and others I'll use TPGi's Color Contrast Analyser, the latter being the better, in my opinion as you don't have to go digging around in the CSS and potentially converting colour formats to Hex so you can paste the values in to WebAIM or similar. The other obvious benefit is you can just select the picker and drag it anywhere across your desktops, but again, it's unlikely there is a keyboard alternative that offers that level of precision (I haven't checked), so whatever tool, browser extension or website you use, just use that if you are comfortable with it.

Persitent states

Just in case you weren't aware, it is possible to force states on elements, which may make it easier to test contrast in a specific state, when I say force state, I mean "focus" and "hover" states. To do this you would need to locate the interactive element in the DevTools and highlight that element in the Elements pane (the HTML).

Once we have the element, by whichever way works for you, in Chrome and Firefox we need to look at the Styles pane and locate a tab called ":hov" which will expand and display some states. In Safari, we would again need to locate the Styles pane, but then ensure the "Pseudo" button was selected and this would display the same states as Chrome and Firefox.

I'm going to provide two screenshots, one in Chrome and one in Safari (Firefox is pretty much the same as Chrome) and I will add a series of arrows to indicate which options to choose. I'm using our Home page for this and you may notice that I have only checked the :focus-visible pseudo selector for this, this is because we use :focus-visible for our focus styles, so they only show on keyboard as opposed to when a user clicks that element with a mouse. We use slightly different styles for mouse interaction. You may need to select :focus or even both :focus and :focus-visible depending on the site you are looking at. There is also a :focus-within selector, which on rare occasions may be useful to check, however, this will typically be for a parent element of the element in question, and I don't tend to find this used as the sole focus indicator often at all, if ever, but it's important to know it is there, just in case. these are checkboxes, so you can of course select multiple.

Screenshot of the Chrome DevTools, showing focus-visible forced on an element, the steps are listed below

The steps in the Chrome/Firefox Devtools are like so: Locate and select element in Elements pane > select ":hov" in the Styles pane > select :focus and/or :focus-visible in the pseudo states panel > the element that is highlighted should now have a decorative pip on in the Elements pane, indicating that a state has been forced upon it.

Screenshot of the Safari Web Inspector, showing focus-visible forced on an element, the steps are listed below

The steps in the Safari Web Inspector are like so: Locate and select element in Elements pane > select "Pseudo" in the Styles pane > select :focus and/or :focus-visible in the pseudo states panel > the element that is highlighted should now have a decorative pip on in the Elements pane, indicating that a state has been forced upon it.

A quick warning, before we start

All of the examples I am going to create will be actual examples using HTML and CSS, where possible (with the exception of images and charts). I'm going down this route, as opposed to using screenshots just so you can inspect the code or use tools you are familiar with or even learn how to use new ones. You may even wish to determine which semi-automated checkers pick up some issues and which don't. Obviously many of these elements will fail WCAG, many will have absolute (px) font sizes, they'll mostly be inline styles (yuck) and they'll generally be rubbish, but in order to tell you what is bad, I gotta give you the bad stuff, I guess. The interactive elements will be redundant, a button won't do anything, a link won't go anywhere and an input won't do anything with the text you may errm, input, unless there is an instruction to do something to cause a change in state, etc.

In addition, I'm excluding the actual examples from our theme changer, which I apologise for. The reason I am doing this is not because it is beyond me, or not because it isn't worth it, it's simply because it will take quite a lot of time. As an example, most of the elements I create will be against a pure white (#FFF) background. I then have to find both passing and failing colours for 3:1 and 4.5:1, this bit is easy. But, then what I would need to do, is flip the background to pure black and then try to find colours that have exactaly the same contrast ratio against the black, as the light theme's examples did against the white, so my text makes sense. If I couldn't find those exact matches, then everywhere I had mentioned a specific contrast ratio, the colour of the background and the colour of the element I would have to manipulate the DOM with JavaScript or use CSS media queries to change or display different text nodes that had the values in, etc. This would be a bit much, so again, I'm sorry, but the examples will all be in light mode.

Inactive user interface component

What is an "inactive user interface component"?, well, if it has the HTML "disabled" attribute then that is definitely inactive. Just adding aria-disabled="true" isn't the same as the disabled attribute, as it would still receive focus and a keyboard-only user may get a little confused. I interpret this to mean either using the disabled attribute, or rolling your own, so I would expect it to:

As with most accessibility topics, there's an Adrian Roselli article that discusses why disabling controls is mostly bad practice. So, if you're building or designing a page, then typically you want to try other options before disabling inputs or buttons, but that's not the purpose of this article, but you should read Adrian's article, as Adrian is very wise.

1.4.3 Contrast (Minimum) (AA)

We're starting with this one as it is perhaps the least complex of the three, there is not a great deal to reveal here as this particular SC applies only to text and images of text.

Summary

Text and informational images of text must at least meet the minimum contrast ratios for their size, except for the following:

Text that meets one of the following two criteria for "large text" must have a contrast ratio of at least 3:1:

Text that is not "Large text", we'll call it "Regular text" must have a minimum contrast of 4.5:1, regular text is either:

Summary explained

Size and weight of text and images of text

The good thing with these is when we are testing actual text we can find out the values, most tools will tell you that they pass or fail at given size and/or weight combinations. Where this does get a bit tricky is testing the size and/or weight of images of text. The DevTools can't help us here as it is an image and that means we can't find out a great deal of information, as images are just pixels and carry no useful informatiun we can access through CSS. Text, on the other hand has a lot of other wizardy going on under the hood. As an example, a browser parses code and will lay out text accordingly, it will know to present text on the screen and it knows knows to send text to the accessibility tree (unless of course it is somehow hidden), it knows to "paint" the characters in whatever styles are set, be that from a custom stylesheet or if there isn't an author defined stylesheet set, the browser will use its own styles. As text has various properties we can inspect, we can determine the size and weight, easily.

So, what do we do when we discover an image of text that has a contrast of 3.5:1, as an example and we suspect it either lacks sufficient weight or size? Good question. Well the first thing we should do is determine if this image of text actually needs to be an image or could it just be actual text? If we could achieve the exact same result (or close enough, but accessible) by using actual text as opposed to an image then we simply fail it against SC 1.4.5 Images of Text (AA). If it is something that cannot be recreated with web technologies, such as a photograph of an historical document, or whatever, and the the purpose of the image is to show the actual document, then we need to find out whether there is a suitable text alternative close by. If there is not an actual text alternative which at the very least includes a verbatim transcript, then this of course, is a problem. If the document was in old cursive, faded handwriting and the pages were yellowed with age, or whatever, and it was clear that the contrast was low, I'd be expecting and requesting that a text alternative be present close by and this would be text that can be accessed by everybody, not just alt text and if that weren't the case, I would fail it against SC 1.1.1 Non-text Content (A). if it had alt text, I would mention this as a good point, but would emphasise it does not provide a suitable alternative to many users as it would still lack the required contrast and only screen reader users would actually get the alt text, in most circumstances. But remember, this only applies if the content is informational, if the purpose of the image was just to show how historical documents yellow over time, then it's not actually important what it says, as the subject is manky paper, not the written words.

Those two SC's will pretty much cover most instances where we have reason to believe that the text has an inadequate weight and/or size for its given contrast ratio. I've never personally had to measure a font on the screen using ruler browser extensions or opening it up in Photoshop, fingers crossed that remains the case and I don't want to jinx myself by explaining how I would go about it, either.

It's also worth noting that images of text do have a scaling issue. It's well documented that zooming an image will cause pixelation and distortion as raster images simply don't zoom well. The point I am making here, though, is, let's say we have a small piece of instructional text, inside an image, the sole purpose of said image is to provide this instruction (obviously an instruction should be actual text). We determine that the contrast is likely fine due to it being visually evident that the font size and weight are about 20px and bold. We're likely looking on a monitor or laptop, right? What about if we test under SC 1.4.10 Reflow (A) conditions (1280px browser width * 400% zoom), when that image scales down to fit a "smaller viewport", is that text now still sufficiently large enough to be "Large text"? If the image fitting on the viewport of a "mobile" screen seems very small, then it would likely fail Contrast (Minimum), as there is no exception for viewport size. So, basically, what I am trying to say, is that testing the size and weight of text in an image is awkward, there are lots of reasons why images of text are bad practice, and several success criteria it would need to satisfy before you started attempting to count pixels and stuff.

Incidental text

This basically means text that really doesn't matter, it doesn't add any information or value to the image or in the case of a photograph, it's just there, we have no control over text in a high street background, when the subject of the photo is a person shopping. In this case as long as the image had decent alt text that stated who was in the image, what they were doing (shopping?) and where they were (Oxford St, London), that would be sufficient, it's irrelevant that there's low contrast text in a shop window, in the background.

Logos

Company logos do not need to have adequate contrast against their background for the purposes of WCAG so if it has ultra low contrast, you don't have a WCAG issue, you may have a branding/design issue, but that's none of my business.

Inactive user interface component

User interface components that are either "disabled" or are functionally equivalent to "disabled" are also excluded from meeting contrast, but remember where we discussed this, earlier? It may not always be the best approach.

Text contrast examples

Let's take a look at some examples I have rustled up:

IDElementPass/fail
CM1Font-weight is normal, font-size is 18px, contrast is: 4.45:1Fail
CM2Font-weight is normal, font-size is 18px, contrast is: 4.6:1Pass
CM3Font-weight is bold, font-size is 18px, contrast is: 3.05:1Fail
CM4Font-weight is bold, font-size is 18.66px, contrast is: 3.05:1Pass
CM5Font-weight is normal, font-size is 23.99px, contrast is: 3.05:1Fail
CM6Font-weight is normal, font-size is 24px, contrast is: 3.05:1Pass
CM7font-size 18px, font-weight is normal, contrast is: 3.05:1Fail
CM8font-size 18px, font-weight is normal, contrast is: 2.95:1Pass
CM9A made up ACME logo, with low contrast, the tagline is: we sell stealth stuffContrast is 1.8:1, the size, weight and contrast don't matter herePass
CM10

Placeholder contrast is 4.45:1

Fail
CM11

Placeholder contrast is 4.6:1

Pass
CM12An image of some text, which is largely irrelevant, it's just asking 'Why is this an image?'

Image text has a 4.27:1 contrast against the background, the font-size is 18px

fail
CM13An image of some text, which is largely irrelevant, it's just asking 'Why is this an image, too?'

Image text has a 4.5:1 contrast against the background, the font-size is 18px

Pass

Text Contrast summary

I've chosen colours that are either close to passing or close to failing for good reason, some folks may discover this article one day and think "Wow, I can't tell the difference". This of course matters a lot when selecting colours to use, as oftentimes just doing enough to pass a particular requirement is not accessible to everybody. It can be quite easy to think "WCAG says this is accessible", but that's not actually what WCAG says, it may say something is "conformant" in that it passes a particular SC, but accessibility is obviously about people and just scraping the minimum will certainly make using your site easier for more people, but not as many people as it could. So, please do consider this when selecting colour palettes and what not.

Scraping the minimum

Quite often when we request that text contrast is increased on a UI and the fix is made we retest the site/app and the contrast is something like 4.52:1. Yes this passes, but that doesn't make it "accessible", some folks will genuinely still struggle to read that comfortably and as always, WCAG is the floor, not the ceiling. So, it really is better to not just begrudgingly move the contrast needle just past the "compliant" notch. I wouldn't suggest putting peddle to the metal and doing pure black on white (contrast 21:1), as some folk have disabilities that make that too difficult to read or cause them migraines, etc. There is possibly a "Goldlocks Zone" for contrast and whilst I don't know if there is an agreed range, based upon actual user testing, I personally look at the Level AAA contrast requirement 1.4.6 Contrast (Enhanced) as a decent guideline, which requires a 7:1 contrast ratio and a 4.5 contrast ratio for "regular" text and "large" text, respectively. But, again, as us humans are so diverse, there is not going to be a range that works for absolutely everyone, because disabilities are diverse, too.

Common gotcha

Often when somebody seemingly begrudgingly fixes something and the new contrast barely scrapes the minimum, it tends to do so on the primary background colour. It's pretty much nailed on that somewhere on the site, if not today, then in the future, somebody will add a container for some text that uses a slightly different background, to add emphasis, draw attention to it or to make it look "nice", only now that text fails, so scraping the minimum wasn't really the smartest move. Had that text have had a 5:1 contrast ratio, that very light background likely wouldn't have caused the failure, but, what do us accessibility folks know, huh?

When I received a failure against contrast for our brand colours, I was annoyed. How dare those pesky accessibility folk request I make the colour darker, to help people actually see our stuff? How dare the law dictate which colours I can use? Well, I'll show those pesky kids, this just scrapes the 4.5:1 minimum, I win.

Dave the Designer, 2025

As our pretend designer only just scraped the minimum contrast requirement, they did so for a pure white background. But as is often the case, they then used that colour against a wispy grey background to draw attention to some text. The result is then 4.23:1 contrast 🤦

1.4.11 Non-text Contrast (AA)

Non-text Contrast applies to, you guessed it, elements that provide information or users need to identify, that aren't text or images of text and the contrast ratio is at least 3:1 against the bac"adjacent pixels" which could be internal or external backgrounds or borders, etc. These could be:

Summary

Summary explained

As the contrast requirement is 3:1 here, then of course 2.99:1 is still a fail. There is some nuance to this SC and it's important to understand what that is, just so you don't go failing something and then have somebody else try to discredit you for your misinterpretation, I'll explain some:

Icons

If an icon is used in place of a text label or to otherwise communicate information that is necessary for understanding a part of the UI, then contrast must pass the 3:1 minimum. Examples could be:

Borders

If a border is the only way of identifying a control, then that border must have a minimum contrast of 3:1, some examples could be:

Focus indicators

If when an element has a visible focus indicator that either adds or subtracts a graphical feature to an element when it receives focus, then that visual element (additional pixels?) must have a minimum 3:1 contrast, some examples are:

Something that doesn't apply to this particular success criterion is colour inversion, so simply put, if we had white link text that was surronuded with a green background in its unfocussed state and when it received focus the background changes to white and the text green, then all that has happened is the colours of existing pixels have swapped, so this isn't the SC that we would look at here. "Existing pixels" is perhaps a bit of a rubbish term, those pixels already exist, they're part of the hardware on your screen, so to explain it better, we're not adding or removing some visual feature or modifying the existing styles with anything other than colour, we determined the element has 2 aspects, the text and its background, the colours just inverted, no additional shape or decoration became part of the element. We'll actually look at this later, so please bear with, if my explanation isn't the best.

Data visualisations

Where data is represented by charts, graphs and other visualisations and those visualisations are necessary for the understanding of that data, then these too are required to have the 3:1 minimum contrast.

In essence, all parts of the chart that are necessary for the understanding and interpretation of the data must have a minimum contrast of 3:1, unless of course it's text, then Contrast (Minimum) applies

Meaningful graphical elements

This essentially covers anything else that I never covered as I couldn't think of enough similar things to group them with.

In essence, if it is there to communicate meaning or it is operable and it isn't text, it's more than likely this SC it would need to pass, although we haven't got to Use of Colour, just yet, so bear with.

Exceptions

There are exceptions here, of course. Again, inactive user interface components, elements that have been styled by the user agent (browser), decorative elements (elements that are solely there for design and aesthetics), buttons actually don't need to have a border or background that has a 3:1 contrast against their background, as the text or icon is the "important" part for WCAG testing, I'm not a great fan of this particular bit, I think the button should either have a background or border that has a 3:1 contrast ratio as it certainly helps with identifying them. Remember, just because we don't have to make a certain part of something meet contrast requirements, it doesn't mean we shouldn't, because the goal is always to make websites and apps as accessible as we can, right?

Non-text Contrast examples

It's impossible to cover everything here, but I've created a large number of examples:

IDElementPass/fail
NT1
phone icon, the phone is white, its background is a light violet colour, this fails

The icon consists of a white phone shape and a violet coloured background. The phone shape's contrast is 2.1:1 against the background.

Fail
NT2
phone icon, the phone is black, its background is a light violet colour, this passes

The icon has a phone shape which is black and a violet coloured background. The phone shape's contrast is 9.9:1 against its background

Pass
NT3

The border on the input has a contrast ratio of 2.8:1 against the page background

Fail
NT4

The border on the input has a contrast ratio of 3.05:1 against the page background

Pass
NT5

The button's background has a contrast of 1.11:1 against the page background (the text is fine and doesn't matter for this SC)

Pass
NT6

The button's background has a contrast of 8.4: against both the text and page background

Pass
NT7

The button's icon has a contrast of 2.94:1 against its background

Fail
NT8

The button's icon has a contrast of 3.06:1 against its background

Pass
NT9

We do not have a focus indicator ring, border, underline, etc

Pass
NT10

The focus ring on the input has a contrast ratio of 5.9:1 against the page background

Pass
NT11

The focus ring on the button has a contrast ratio of 2.8:1 against the page background

Fail
NT12

The focus ring on the button has a contrast ratio of 5.9:1 against the page background

Pass
NT13

Just a link inline with a paragraph of text

The text decoration (the underline) is the only way to identify this is a link (body text and link colour are the same), the decoration's colour has a contrast of 2.92:1

Fail
NT14

Just another link inline with a paragraph of text

The text decoration (the underline) is the only way to identify this is a link (body text and link colour are the same), the decoration's colour has a contrast of 3.15:1

Pass
NT15A trendline chart screenshot, the trendline has a contrast lower than 3.1

The trendline in the above chart has a contrast of 2.81:1

Fail
NT16A trendline chart screenshot, the trendline has a contrast higher than 3.1

The trendline in the above chart has a contrast of 3:22:1

Pass

Non-text Contrast summary

Perhaps there is quite a bit to unpack, here? maybe if you are relatively new, there are a couple of surprises?

This isn't a comprehensive list of graphical elements, if you have read the understanding docs, you will notice they mention some elements that I don't, such as rating stars (contrast against background), text-based symbols and other elements. I have omitted some as they will be discussed, later and others are self-explanatory.

1.4.1 Use of Color (A)

"Color is not the only way of distinguishing information". This one is particularly interesting, as unlike Contrast (Minimum) and Non-text Contrast, this can apply to both "graphical" elements and text, so initially it appears there is a lot of overlap with this one, but once you gain a decent understanding of it, it doesn't seem to overlap as much, if it all. I like to view this particular SC in a way that firstly, the element I am interested in has to pass one of the other two contrast SCs first, then, this one comes into play if and only if the colour is being used to convey something, such as a state, or differentiating between its colour and a related or close by element's colour, etc.

Summary

Colour alone must not be used as the only way of conveying information. Colour (hue) is not lightness, so having a contrast of 3:1 from the element we are comparing against or this element's former state actually passes, as a contrast ratio of 3:1 uses lightness to calculate the contrast.

Summary explained

It's important to remember that for any of the examples given, they are only under consideration if only colour is used or the contrast is less than 3:1. This is one of those requirements where often we should be looking at best practices to get something that is actually accessible as some folk will struggle with the 3:1 difference, so other visual cues should definitely be used. As with all aspects of accessibility, if I wear my "developer" hat I can easily ensure that all elements have both good contrast and other visual cues, but, when I wear my "auditor" hat, sometimes I just don't have the clout to get best practices implemented, still, we have to keep trying to push the best practices forward.

Other success criterion can come into play with this one, as an example 1.3.3 Sensory Characteristics (A), would be my go to if there were instructions on the page that said "Form errors are marked in red" or "click the green button".

On this one I feel it's a little better to just jump to the examples, as opposed to breaking down the items in the summary list:

Use of Color examples

IDElementPass/fail
UC1

For this explanation, assume the first input is untouched and the second is in an error state. Text contrast is 14.93:1 against its background on the first input, when the input is in error the text colour changes to a dark red, that red colour has a 5.19:1 contrast against the background. The contrast difference between initial text and error text is 2.87:1

Fail
UC2

For this explanation, the only colour I have changed is the red, which now has a contrast difference of 3.12:1 against the first input's text label.

Pass
UC3
Name cannot be blank

Use of Color does not apply, as there is an error message, which is not using colour alone to convey any information.

Pass
UC4

Use of Color does not apply, as there is an error icon, which is not using colour alone to convey any information.

Pass
UC5

The button's text in its unfocussed state has a contrast of 8.4:1 against its background and the text within, when focussed the button's text has 4.63:1 contrast against the button's background, the difference between the two purple backgrounds of the button is 1.81:1 between focussed and unfocussed states

Fail
UC6

The button's text in its unfocussed state has a contrast of 8.4:1 against its background and the text within, when focussed the button's text has 4.61:1 (as the text changes colour, too) contrast against the button's background, the difference between the two purple backgrounds of the button is 3.06:1 between focussed and unfocussed states, and the change in contrast for the text is 12.63:1

Pass
UC7

The button's text in its unfocussed state has a contrast of 8.4:1 against its background and the text within, when focussed the button's background and text swap colours, so the contrast calculation actually remains unchanged.

Pass
UC8A pie chart which is 3 sections in a monochrome colour scheme. Each colour is a varying shade of blue, and contrast fails between 2 of the shades

The contrast between the two darker shades is 1.3:1, the lighter shade against the background is 2.2:1 and all other combinations have a contrast that exceeds 3:1

Fail
UC9A pie chart which is 3 sections in a monochrome colour scheme. Each colour is seperated by a border and the labels are on the slices

The colours are the same as the previous example, this time the chart has been expoloded, borders added to segments and all of each segment's labels are present within their respective segments

Pass
UC10

Just some text that contains a link in it.

The link is not underlined nor does it have any other stylistic feature that makes it visually different than the body text, other than a change in colour. The link text has a contrast of 5.39:1 against the background, the contrast difference between the link text and body text is 2.76:1.

Fail
UC11

Just some text that contains a link in it.

The link is not underlined nor does it have any other stylistic feature that makes it visually different than the body text, other than a change in colour. The link text has a contrast of 4.77:1 against the background, the contrast difference between the link text and body text is 3.13:1.

Pass
UC12

Just some text that contains a link in it.

The link is not underlined nor does it have any other stylistic feature that makes it visually different than the body text, not even a change in colour. The link text has a contrast of 14.93:1 against the background, as does the body text.

Pass

Use of Color summary

Wrapping up

That was some read, huh? Sorry, there's quite a bit to unpack and I could have provided way more examples than I did, as discussing all three Level AA colour and contrast criteria in one guide was quite an ambitious task, I guess.

So, hopefully we have learned something and we can use this going forward? Just to recap:

None of this is intended to dissuade designers and developers from using colour, quite the opposite, colour is an important tool, more so when used responsibly. Feel free to use colour wherever you want, just ensuring that contrast is adequate, and provide additional affordances where they make sense. Consider people and be creative in how to use colour without excluding people. Contrast matters, because all users matter, design for people and not dodgy web trend sites that loads of people wouldn't be able to use, anyway.

Share on:

TwitterLinkedIn

Site preferences

Please feel free to display our site, your way by finding the preferences that work best for you. We do not track any data or preferences at all, should you select any options in the groups below, we store a small non-identifiable token to your browser's Local Storage, this is required for your preferencesto persist across pages accordion be present on repeat visits. You can remove those tokens if you wish, by simply selecting Unset, from each preference group.

Theming

Theme
Code block theme

Code theme help

Code block themes can be changed independent of the site theme.

  • Default: (Unset) Code blocks will have the same theme as the site theme.
  • Light 1: will be default for users viewing the light theme, this maintains the minimum 7:1 (WCAG Level AAA) contrast ratio we have used throughout the site, it can be quite difficult to identify the differences in colour between various syntax types, due to the similarities in colour at that contrast ratio
  • Light 2: drops the contrast for syntax highlighting down to WCAG Level AA standards (greater than 4.5:1)
  • Dark: Syntax highlighting has a minimum contrast of 7:1 and due to the dark background differences in colour may appear much more perceivable

Motion

Motion & animation

Motion & animation help

  • Default (Unset): Obeys device settings, if present. If no preference is set, there are subtle animations on this site which will be shown. If you have opted for reduce motion, smooth scrolling as well as expanding and collapsing animations will no longer be present, fading transtitions and micro animations will still be still present.
  • None: All animations and transitions are completely removed, including fade transitions.

Links

Underline all links

Underline all links help

  • Default (Unset): Most links are underlined, with a few exceptions such as: the top level links in the main navigation (on large screens), cards, tags and icon links.
  • Yes: Will add underlines to the exceptions outlined above, resulting in every link being underlined

Text and paragraphs

Font size (main content)

Font size help

This setting does not apply to the site's header or footer regions

  • Default (Unset): Font sizes are set to site defaults
  • Selecting Large or Largest will increase the font size of the main content, the size of the increase depends on various factors such as your display size and/or zoom level. The easiest way to determine which option suits you best would be to view this text after clicking either size's button
Letter spacing

Letter spacing help

  • Default (Unset): Default letter spacing applies
  • Increased: Multiplies the font size by 0.12 and adds the sum as spacing between each character
Line height

Line height help

  • Default (Unset): all text has a minimum line height of 1.5 times the size of the text
  • Increased: all text has a line height of twice the size of the text
Line width

Line width help

  • Default (Unset): all text has a maximum line width of 80 REM units (this averages around 110 characters per line)
  • Decreased: all text has a maximum line width of 55 CH units (this averages around 80 characters per line)
Paragraph spacing

Paragraph spacing help

  • Default (Unset): The space between paragraphs is equivalent to 1.5 times the height of the paragraph's text
  • Increased: The space between paragraphs is equivalent to 2.25 times the height of the paragraph's text
Word spacing preference

Word spacing help

  • Default (Unset): No modifications to word spacing are present
  • Increased: Spaces between words are equivalent to 0.16 times the font size