Closed avp closed 10 years ago
Find out if a color would be classified as light and/or dark.
For example, when using light colors, dark text looks good. So we need a function light() that returns true if the color is light and false otherwise.
light()
true
false
From http://24ways.org/2010/calculating-color-contrast/:
function getContrastYIQ(){ var yiq = ((r*299)+(g*587)+(b*114))/1000; return (yiq >= 128) ? 'dark' : 'light'; }
Find out if a color would be classified as light and/or dark.
For example, when using light colors, dark text looks good. So we need a function
light()
that returnstrue
if the color is light andfalse
otherwise.From http://24ways.org/2010/calculating-color-contrast/: