public class ColorUtils extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
ColorUtils.Lightness |
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
IS_DARK |
static int |
IS_LIGHT |
static int |
LIGHTNESS_UNKNOWN |
| 限定符和类型 | 方法和说明 |
|---|---|
static int |
blendColors(int color1,
int color2,
float ratio)
Blend
color1 and color2 using the given ratio. |
static Palette.Swatch |
getMostPopulousSwatch(Palette palette) |
static boolean |
isDark(android.graphics.Bitmap bitmap,
int backupPixelX,
int backupPixelY)
Determines if a given bitmap is dark.
|
static int |
isDark(Palette palette)
Checks if the most populous color in the given palette is dark
Annoyingly we have to return this Lightness 'enum' rather than a boolean as palette isn't
guaranteed to find the most populous color.
|
static int |
modifyAlpha(int color,
float alpha)
Set the alpha component of
color to be alpha. |
static int |
modifyAlpha(int color,
int alpha)
Set the alpha component of
color to be alpha. |
static int |
scrimify(int color,
boolean isDark,
float lightnessMultiplier)
Calculate a variant of the color to make it more suitable for overlaying information.
|
static int |
scrimify(int color,
float lightnessMultiplier) |
public static final int IS_LIGHT
public static final int IS_DARK
public static final int LIGHTNESS_UNKNOWN
public static int modifyAlpha(int color,
int alpha)
color to be alpha.public static int modifyAlpha(int color,
float alpha)
color to be alpha.public static int blendColors(int color1,
int color2,
float ratio)
color1 and color2 using the given ratio.ratio - of which to blend. 0.0 will return color1, 0.5 will give an even blend,
1.0 will return color2.public static int isDark(Palette palette)
public static Palette.Swatch getMostPopulousSwatch(Palette palette)
public static boolean isDark(android.graphics.Bitmap bitmap,
int backupPixelX,
int backupPixelY)
public static int scrimify(int color,
boolean isDark,
float lightnessMultiplier)
color - the color to adjustisDark - whether color is light or darklightnessMultiplier - the amount to modify the color e.g. 0.1f will alter it by 10%public static int scrimify(int color,
float lightnessMultiplier)