public class LightHelper extends Object
| Modifier and Type | Method and Description | 
|---|---|
| static int | darkenColor(int color,
           int factor)Gets a darkened version of a color. | 
| static int | getDarkestColor(int color1,
               int color2)Gets the darkest of two colors. | 
| static int | getLight(int color)Gets the light level of a color. | 
| static int | getLightestColor(int color1,
                int color2)Gets the lightest of two colors. | 
| static int | getMostContrastingColor(int colorToContrast)Gets the color that best contrasts against a given color. | 
| static int | getMostContrastingColor(int colorToContrast,
                       int color1,
                       int color2)Gets the color that best contrasts against a given color. | 
| static boolean | isLightColor(int color)Gets whether a color is light or dark. | 
| static int | lightenColor(int color,
            int factor)Gets a lightened version of a color. | 
public static int darkenColor(int color,
                              int factor)
Note that passing a negative factor value, the method will return a lighter color.
color - the color to darken.factor - the darkening factor.public static int getDarkestColor(int color1,
                                  int color2)
color1 - first color.color2 - second color.public static int getLight(int color)
color - the color.public static int getLightestColor(int color1,
                                   int color2)
color1 - first color.color2 - second color.public static int getMostContrastingColor(int colorToContrast)
Colors.WHITE or
 Colors.BLACK.colorToContrast - the color to contrast.Colors.BLACK if the given color is light, Colors.WHITE otherwise.isLightColor(int)public static int getMostContrastingColor(int colorToContrast,
                                          int color1,
                                          int color2)
colorToContrast - the color to contrast.color1 - the first color.color2 - the second color.isLightColor(int)public static boolean isLightColor(int color)
color - the color to test.true if the color is a light one, false otherwise.public static int lightenColor(int color,
                               int factor)
Note that passing a negative factor value, the method will return a darker color.
color - the color to lighten.factor - the lightening factor.