Last active
December 19, 2015 17:19
-
-
Save snorpey/5990260 to your computer and use it in GitHub Desktop.
quickly calculate the brightness of an rgba color in javascript (not accurate but fast)
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
/*global define*/ | |
define( | |
function() | |
{ | |
function brightness( color ) | |
{ | |
// (R+R+B+G+G+G)/6 | |
return ( color[0] + color[0] + color[1] + color[2] + color[2] + color[2] ) / 6; | |
} | |
return brightness; | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment