public class ColorUtils extends Object
Constructor and Description |
---|
ColorUtils() |
Modifier and Type | Method and Description |
---|---|
static float[] |
colorToGlRgbaArray(int color)
Converts Android color int to GL rgba float array.
|
static float[] |
colorToRgbaArray(int color)
Converts Android color int to rgba float array.
|
static String |
colorToRgbaString(int color)
Converts Android color int to "rbga(r, g, b, a)" String equivalent.
|
static int |
getAccentColor(Context context)
Returns a color integer associated as accent color from a theme based on a Context.
|
static int |
getPrimaryColor(Context context)
Returns a color integer associated as primary color from a theme based on a Context.
|
static int |
getPrimaryDarkColor(Context context)
Returns a color integer associated as primary dark color from a theme based on a Context.
|
static ColorStateList |
getSelector(int color)
Returns a color state list associated with a theme based on a Context.
|
static int |
rgbaToColor(String value)
Convert an rgba string to a Color int.
|
static void |
setTintList(ImageView imageView,
int tintColor)
Set a color tint list to the Drawable of an ImageView.
|
public static int getPrimaryColor(Context context)
context
- The context used to style the color attributes.public static int getPrimaryDarkColor(Context context)
context
- The context used to style the color attributes.public static int getAccentColor(Context context)
context
- The context used to style the color attributes.public static ColorStateList getSelector(int color)
color
- The color used for tinting.public static void setTintList(ImageView imageView, int tintColor)
imageView
- The view to set the default tint list.tintColor
- The color to tint.public static int rgbaToColor(String value)
value
- the String representation of rgbaConversionException
- on illegal inputpublic static String colorToRgbaString(int color)
Alpha value will be converted from 0-255 range to 0-1.
color
- Android color intpublic static float[] colorToRgbaArray(int color)
Returned RGB values range from 0 to 255. Alpha value ranges from 0-1.
color
- Android color intpublic static float[] colorToGlRgbaArray(int color)
Returned values range from 0-1.
color
- Android color int© 2015–2018 Mapbox. All rights reserved.