code: public static boolean isColorDark(int color) {
          return ((30 * Color.red(color) +
                  59 * Color.green(color) +
                  11 * Color.blue(color)) / 100) <= BRIGHTNESS_THRESHOLD;
      }
docs: Calculate whether a color is light or dark, based on a commonly known
  brightness formula.
  
  @see <a href="http://en.wikipedia.org/wiki/HSV_color_space%23Lightness">http://en.wikipedia.org/wiki/HSV_color_space%23Lightness</a>