public static int getDisplayColorFromColor ( int color ) { if ( ! isJellybeanOrLater ( ) ) { return color ; } float [ ] hsv = new float [ 3 ] ; Color . colorToHSV ( color , hsv ) ; hsv [ 1 ] = Math . min ( hsv [ 1 ] * SATURATION_ADJUST , 1.0f ) ; hsv [ 2 ] = hsv [ 2 ] * INTENSITY_ADJUST ; return Color . HSVToColor ( hsv ) ; }
For devices with Jellybean or later darkens the given color to ensure that white text is clearly visible on top of it . For devices prior to Jellybean does nothing as the sync adapter handles the color change .