question: 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 ; }
target:  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