UNPKG

@kcuf/mere-color

Version:

Mere color utils for generating, manipulation, a11y purposes.

20 lines (19 loc) 625 B
import a11yContrast from './a11y-contrast'; /** * Determines which contrast guidelines have been met for two colors. * Based on the [contrast calculations recommended by W3](https://www.w3.org/WAI/WCAG21/Understanding/contrast-enhanced.html). * * @example * const scores = meetsContrastGuidelines('#444', '#fff'); */ export default function a11yContrastGuidelines(fgc, bgc) { var contrast = a11yContrast(fgc, bgc); return { contrast: contrast, AAA: contrast >= 7, AAALarge: contrast >= 4.5, AA: contrast >= 4.5, AALarge: contrast >= 3 }; } //# sourceMappingURL=a11y-contrast-guidelines.js.map