@terrazzo/parser
Version:
Parser/validator for the Design Tokens Community Group (DTCG) standard.
40 lines • 1.41 kB
TypeScript
import type { LintRule } from '../../../types.js';
export declare const A11Y_MIN_CONTRAST = "a11y/min-contrast";
export interface RuleA11yMinContrastOptions {
/**
* Whether to adhere to AA (minimum) or AAA (enhanced) contrast levels.
* @default "AA"
*/
level?: 'AA' | 'AAA';
/** Pairs of color tokens (and optionally typography) to test */
pairs: ContrastPair[];
}
export interface ContrastPair {
/** The foreground color token ID */
foreground: string;
/** The background color token ID */
background: string;
/**
* Is this pair for large text? Large text allows a smaller contrast ratio.
*
* Note: while WCAG has _suggested_ sizes and weights, those are merely
* suggestions. It’s always more reliable to determine what constitutes “large
* text” for your designs yourself, based on your typographic stack.
* @see https://www.w3.org/WAI/WCAG22/quickref/#contrast-minimum
*/
largeText?: boolean;
}
export declare const WCAG2_MIN_CONTRAST: {
AA: {
default: number;
large: number;
};
AAA: {
default: number;
large: number;
};
};
export declare const ERROR_INSUFFICIENT_CONTRAST = "INSUFFICIENT_CONTRAST";
declare const rule: LintRule<typeof ERROR_INSUFFICIENT_CONTRAST, RuleA11yMinContrastOptions>;
export default rule;
//# sourceMappingURL=a11y-min-contrast.d.ts.map