MCPcopy Create free account
hub / github.com/microsoft/SandDance / contrast

Function contrast

docs/app/js/sanddance-app.js:142920–142923  ·  view source on GitHub ↗
(color1, color2)

Source from the content-addressed store, hash-verified

142918 return 0.2126 * r + 0.7152 * g + 0.0722 * b;
142919} // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
142920function contrast(color1, color2) {
142921 const lum1 = luminance(color1), lum2 = luminance(color2), lumL = Math.max(lum1, lum2), lumD = Math.min(lum1, lum2);
142922 return (lumL + 0.05) / (lumD + 0.05);
142923}
142924function merge() {
142925 const args = [].slice.call(arguments);
142926 args.unshift({});

Callers

nothing calls this directly

Calls 3

luminanceFunction · 0.70
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected