Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/a11y_color_contrast/wcag.ts

A TypeScript package to calculate WCAG 2.0/3.0 and APCA color contrasts
Latest
import * as a11yColorContrast from "https://deno.land/x/a11y_color_contrast@v0.2.0/wcag.ts";

Functions

See https://www.w3.org/WAI/WCAG22/Techniques/general/G17.html for concrete details for WCAG 2.2.

See https://www.w3.org/WAI/WCAG22/Techniques/general/G17.html for concrete details for WCAG 2.2.

See https://www.w3.org/WAI/WCAG22/Techniques/general/G17.html for concrete details for WCAG 2.2.

This function calculates the contrast and whether two colors used together are readable based on WCAG readability criteria. The first color is the foreground color and the second the background color (defaulting to pure white, "#FFF" / [255, 255, 255]).

This function calculates the contrast value between two colors based on WCAG contrast readability criteria. The first color is the foreground color and the second the background color (defaulting to pure white, "#fff" / [255, 255, 255]).

This function determines whether two colors used together are readable based on WCAG readability criteria. The first color is the foreground color and the second the background color (defaulting to pure white, "#fff" / [255, 255, 255]).