-
public class ColorUtilSimple utility class for manipulating colors, based on Fresco's DrawableUtils (https://github.com/facebook/fresco). For a small helper like this, copying is simpler than adding a dependency on com.facebook.fresco.drawee.
-
-
Method Summary
Modifier and Type Method Description static intmultiplyColorAlpha(int color, int alpha)Multiplies the color with the given alpha. static intgetOpacityFromColor(int color)Gets the opacity from a color. static intnormalize(double r, double g, double b, double a)Converts individual {r, g, b, a} channel values to a single integer representation of the coloras 0xAARRGGBB. -
-
Method Detail
-
multiplyColorAlpha
static int multiplyColorAlpha(int color, int alpha)
Multiplies the color with the given alpha.
- Parameters:
color- color to be multipliedalpha- value between 0 and 255
-
getOpacityFromColor
static int getOpacityFromColor(int color)
Gets the opacity from a color. Inspired by Android ColorDrawable.
- Parameters:
color- color to get opacity from
-
normalize
static int normalize(double r, double g, double b, double a)
Converts individual {r, g, b, a} channel values to a single integer representation of the coloras 0xAARRGGBB.
- Parameters:
r- red channel value, [0, 255]g- green channel value, [0, 255]b- blue channel value, [0, 255]a- alpha channel value, [0, 1]
-
-
-
-