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.
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