Last active
March 28, 2022 14:27
-
-
Save jfsiii/7234419 to your computer and use it in GitHub Desktop.
Relative Luminance from RGB color.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from http://en.wikipedia.org/wiki/Luminance_(relative) | |
// R, G, B are integers between 0 and 255 | |
function relativeLuminance(R, G, B) { | |
var Y = (0.2126 * R + 0.7152 * G + 0.0722 * B) / 255; | |
return Y; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment