yiqBrightness method

int yiqBrightness()

Calculate brightness of a color according to YIQ formula (brightness is Y). More info on YIQ here: http://en.wikipedia.org/wiki/YIQ. Helper method for goog.color.highContrast() @param {goog.color.Rgb} rgb Colour represented by a rgb array. @return {number} brightness (Y). @private

Implementation

int yiqBrightness()
{
  return ( (red * 299.0 + green * 587.0 + blue * 114.0) / 1000.0).round();
}