computeLuminance method

double computeLuminance()

Computes the relative luminance using WCAG 2.0 specification (0.0-1.0). Where R, G, B are the linearized color components.

Implementation

double computeLuminance() {
  final double R = linearizeColorComponent(red / 0xFF);
  final double G = linearizeColorComponent(green / 0xFF);
  final double B = linearizeColorComponent(blue / 0xFF);
  return 0.2126 * R + 0.7152 * G + 0.0722 * B;
}