static boolean isLightColor(final int color){
  final int r=Color.red(color);
  final int g=Color.green(color);
  final int b=Color.blue(color);
  final double threshold=0.21 * r + 0.72 * g + 0.07 * b;
  return threshold > 170;
}

static boolean isLightColor ( final int color ) { final int r = Color . red ( color ) ; final int g = Color . green ( color ) ; final int b = Color . blue ( color ) ; final double threshold = 0.21 * r + 0.72 * g + 0.07 * b ; return threshold > 170 ; }
this method uses hsl to determine in a human eyesight terms if a color is light or not . see : http : / / en . wikipedia . org / wiki / hsl_and_hsv . the threshold values are from itu rec . 709 http : / / en . wikipedia . org / wiki / rec . _709 # luma_coefficients
