ftlabs / perf-widget

22 stars 2 forks source link

A11y #69

Closed AdaRoseCannon closed 8 years ago

AdaRoseCannon commented 8 years ago

Tweak the layout a little.

Iterate over the page and work out how good the contrast is for each text element comparing the text colour to it's background colour (or it's parent until it finds a background colour).

Calculate the number of characters with good contrast (lightness ratio > 4) compared to bad contrast. Warn if too much of the page is in bad contrast.

Lightness calculation taken from the work of Lea Verou: https://github.com/LeaVerou/contrast-ratio/blob/gh-pages/color.js