Best Contrast Colors for Students With Low Vision to Read

Read Time: 7 mins Languages:

Color accessibility is an important part of visual accessibility. People with various types of visual impairments, such as color incomprehension and low vision, perceive colors in dissimilar ways. As a event, the pregnant of colors becomes less significant or is completely lost for users with visual disabilities.

Although virtually articles on color accessibility give design tips similar how to option an accessible color scheme, we will follow a dissimilar arroyo hither. Specifically, we will look into a couple of CSS tips you can use to meliorate colour and contrast accessibility. However, if yous are interested in the design bending, have a look at our tutorial most how to pattern for visual impairments by Graeme Fulton, likewise.

To understand how people affected by visual impairments perceive colors, you can examination any color with ColorHexa's color incomprehension simulator. For case, hither is how the color red (#ff0000) is seen past people with monochromacy, dichromacy, and trichromacy:

Color Blindness Simulator by ColorHexa Color Blindness Simulator by ColorHexa Color Blindness Simulator by ColorHexa

1. Check for Text Readability

Although using high-contrasting colors is an overall goal of accessible design, information technology's especially important to bank check text readability. This means that the text (foreground) and the background behind it need to have a contrast ratio of:

  • at least four.5:1 for normal text and three:1 for large text to see WCAG ii.i Level AA compliance,
  • at least vii:i for normal text and 4.5:1 for large text to come across WCAG 2.i Level AAA compliance.

To learn more well-nigh WCAG 2.1 compliance levels, check out W3C's Web Content Accessibility Guidelines. For a standard website, you should aim for at to the lowest degree Level AA compliance. If your website is specifically for a vulnerable audience such every bit the elderly or persons with disabilities, endeavour to reach Level AAA compliance at to the lowest degree for continuous text blocks.

To ensure text readability, you tin utilise an online contrast checker tool such as the WebAIM Contrast Checker. However, such tools commonly require you to enter color values manually into the app. Every bit an culling, you tin likewise use a browser extension such every bit the WCAG Color Dissimilarity Checker for Chrome that lets you chop-chop check the colour contrast for every element on your page. For instance, this is the color dissimilarity audit it returns for one of our TutsPlus articles:

WCAG Color Contrast Checker for Chrome WCAG Color Contrast Checker for Chrome WCAG Color Contrast Checker for Chrome

With Lighthouse, you tin also run an accessibility inspect that returns all the failing HTML elements that don't have a sufficient color contrast ratio.

Although yous don't demand to take a high color contrast everywhere on the page, you should make headlines, text blocks, hyperlinks, and controls such as buttons and input fields meet at least Level AA compliance for proper text readability.

two. Increase Font Size or Weight

In CSS, there are two quick solutions to set up low color contrast:

  1. You tin can increase font-size or font-weight.
  2. You can adapt the color lightness of either the foreground or the background (see in the adjacent section).

First, let's run across how increasing the value of thefont-size or font-weight properties improves contrast accessibility. If you await at the WCAG 2.1'south color contrast requirements in a higher place, you will see that for larger text, it's sufficient to utilise less contrast. The reason for this is self-explanatory; it's easier to read larger letters on the screen.

According to WCAG 2.1, big-scale text means:

"at to the lowest degree 18 point or 14 point bold font size that would yield equivalent size for Chinese, Japanese and Korean (CJK) fonts".

As the WebAIM's docs mention it, this typically means at least xviii.66px for bold text, and 24px for normal-weight text. On the other hand, the WCAG two.1 docs recommend using relative units rather than pixels so that users can use the Zoom Text Merely functionality in their web browser. In numbers, this ways at to the lowest degree 1.2em for bold text and i.5em for normal-weight text.

And then, if your design allows it, y'all can simply increase the value of the font-size and/or font-weight properties, for example:

3. Use HSL Colors to Improve Color Contrast

If you tin't increase font-size and/or font-weight, you can also suit the lightness of the foreground color to the background color. In the case of a dark background, you need to make the fonts a scrap lighter, while in the case of a lite background, you demand to make the fonts a bit darker.

At that place are different ways to do so, but I volition show you the all-time 1, respectively how to employ the HSL color model to apace conform color lightness. HSL stands for Hue, Saturation, Lightness. It'due south a less widely used colour model than RGB (Red, Green, Bluish) and hexadecimal notations, but it's much more than intuitive. CSS-Tricks also recommends it for programmatic color command and browser back up is besides relatively expert (currently, 93.42% of browsers support information technology globally).

HSL Colors Browser Support HSL Colors Browser Support HSL Colors Browser Support

And so, allow'south see a quick case of how to adjust colour lightness using the HSL colour model. The aforementioned WCAG Color Contrast Checker extension has found that the blue hyperlinks on our article pages have slightly less contrast than the recommended minimum (4.14 instead of4.5). If you open up upward WCAG Colour Dissimilarity Checker on the left side of the browser window and DevTools on the right, this is what you will run into:

Adjusting Color Lightness Adjusting Color Lightness Adjusting Color Lightness

Although the color is defined in hexadecimal notation (#0085b6), you can apace catechumen it to an HSL value using ColorHexa:

Converting hexadecimal notation to HSL Converting hexadecimal notation to HSL Converting hexadecimal notation to HSL

In the code below, the ii CSS declarations lead to the same consequence. Likewise, the hex note can besides be used every bit a fallback method for the hsl() office:

At present, in the Styles tab of Chrome DevTools, you can merely replace the hexadecimal value with the HSL 1 by double-clicking and overwriting it:

Changing Hex Value to HSL in Chrome DevTools Changing Hex Value to HSL in Chrome DevTools Changing Hex Value to HSL in Chrome DevTools

As HSL is a human being-readable format, you only need to modify the Lightness value (35.7%) to improve the color contrast. In this case, you demand to decrease information technology considering on a white background, you will need slightly darker blazon. Y'all can experiment with information technology until the WCAG Color Contrast Checker on the left returns a value higher than 4.5 (don't forget to striking the refresh results push).

On the screenshot below, you tin encounter that it was enough to reduce the Lightness value from 35.7% to 33.7% to meet Level AA Compliance with a colour contrast ratio of 4.six. This is such a small divergence that it's barely visible and doesn't alter the aesthetics of the pattern:

Lightness value fixed Lightness value fixed Lightness value fixed

If you want to add the hex value as a fallback to your CSS, y'all tin quickly convert the new HSL value dorsum using ColorHexa'due south converter in the same way every bit before:

4. Add together a Semi-Transparent Overlay to Background Images

If y'all use text on top of background images, it's besides worth because calculation an overlay with properly adaptedopacity to better colour accessibility. Accept a look, for instance, at the following background image behind the "Explore the Earth" text string:

Background image without overlay Background image without overlay Background image without overlay

In fact, the color contrast ratio is not horrible but it can be certainly improved. You can do so past adding a dark overlay to the HTML chemical element that holds the groundwork image.

The HTML is pretty simple:

The CSS uses accented positioning and the::after pseudo-chemical element to place the overlay right on top of the groundwork prototype:

As y'all demand to darken the background, use a black overlay with an opacity value of around0.3.  In this style, the color contrast between the foreground (white text) and the background volition exist a bit higher:

Background image with overlay Background image with overlay Background image with overlay

To meet the lawmaking in its entirety, check out the post-obit CodePen demo:

v. Examination Colors With the Grayscale Filter

To see how your website looks to someone who doesn't see colors, yous tin apply the filter CSS property with the grayscale() value to the body tag of the page:

For instance, this is how the TutsPlus Web Design tutorial page looks similar without colors:

Test colors with grayscale filter Test colors with grayscale filter Test colors with grayscale filter

Even though total color blindness is rare and near people with visual impairments do run into different (limited) colour spectrums, this technique can however give y'all an insight into how color loses its meaning and what needs to exist adjusted.

Wrapping Up

You can use a couple of piece of cake-to-implement CSS techniques to meliorate color accessibility. The well-nigh important thing is to ensure high color contrast for text blocks, especially when the font size is small. Besides, you can likewise make utilise of the HSL colour model, image overlays, and the opacity and filter backdrop to achieve a better contrast ratio between foreground and background elements.

Learn More About Accessibility

If you are interested in more hands-on CSS tips for ameliorate accessibility, check out my like manufactures on keyboard accessibility and animation accessibility, too.

forestandindeford.blogspot.com

Source: https://webdesign.tutsplus.com/articles/css-tips-for-better-color-and-contrast-accessibility--cms-34472

0 Response to "Best Contrast Colors for Students With Low Vision to Read"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel