Created
May 20, 2020 07:33
-
-
Save vladcorn/102664c4bf71d1ece1f32ab6f1c538b9 to your computer and use it in GitHub Desktop.
Check type of color (dark or light)
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
function colorChecker(red,green,blue){ | |
if (1 - (0.299 * red + 0.587 * green + 0.114 * blue) / 255 < 0.5) { | |
//light | |
} | |
else { | |
// dark | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment