Skip to content

Call out statically detectable bad contrast #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mathiasbynens opened this issue Jun 22, 2020 · 0 comments
Open

Call out statically detectable bad contrast #55

mathiasbynens opened this issue Jun 22, 2020 · 0 comments

Comments

@mathiasbynens
Copy link

According to WCAG’s Success Criterion 1.4.3, text should have a contrast ratio of at least 4.5, while large text (which starts at around 24px or 18.67px bold) should have a contrast ratio of at least 3.

Although we cannot statically detect all cases of bad contrast (we cannot even predict what font size will be used, given browser zooming settings), we can detect the worst cases (ratio below 3), and maybe additionally warn for values below a configurable threshold (say, 2.5).

The formulas are here: https://w3c.github.io/wcag/understanding/contrast-minimum.html#dfn-contrast-ratio Here's the implementation in Chrome DevTools: https://source.chromium.org/chromium/chromium/src/+/master:third_party/devtools-frontend/src/front_end/common/ColorUtils.js;l=72-86;drc=91403e7b5c9ae2717db9243d177f8644d0d712be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant