source: trip-planner-front/node_modules/colord/plugins/a11y.d.ts@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
1import { AnyColor } from "../types";
2import { Plugin } from "../extend";
3interface ReadabilityOptions {
4 level?: "AA" | "AAA";
5 size?: "normal" | "large";
6}
7declare module "../colord" {
8 interface Colord {
9 /**
10 * Returns the relative luminance of a color,
11 * normalized to 0 for darkest black and 1 for lightest white.
12 * https://www.w3.org/TR/WCAG20/#relativeluminancedef
13 * https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_Colors_and_Luminance
14 */
15 luminance(): number;
16 /**
17 * Calculates a contrast ratio for a color pair.
18 * This luminance difference is expressed as a ratio ranging
19 * from 1 (e.g. white on white) to 21 (e.g., black on a white).
20 * WCAG requires a ratio of at least 4.5 for normal text and 3 for large text.
21 * https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html
22 * https://webaim.org/articles/contrast/
23 */
24 contrast(color2?: AnyColor | Colord): number;
25 /**
26 * Checks that a background and text color pair conforms to WCAG 2.0 requirements.
27 * https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html
28 */
29 isReadable(color2?: AnyColor | Colord, options?: ReadabilityOptions): boolean;
30 }
31}
32/**
33 * A plugin adding accessibility and color contrast utilities.
34 * Follows Web Content Accessibility Guidelines 2.0.
35 * https://www.w3.org/TR/WCAG20/
36 */
37declare const a11yPlugin: Plugin;
38export default a11yPlugin;
Note: See TracBrowser for help on using the repository browser.