getLuminance function
- int color
Returns the luminance (grayscale) value of the color
.
Implementation
int getLuminance(int color) {
var r = getRed(color);
var g = getGreen(color);
var b = getBlue(color);
return (0.299 * r + 0.587 * g + 0.114 * b).round();
}