public final class ColorHelper
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static int |
blendColors(int color1,
int color2,
float ratio)
Blends two colours to produce a single output colour.
|
static int |
getAccentColor(android.content.Context context,
int defaultColor)
Extracts the accent color from a theme.
|
static int |
getPrimaryColor(android.content.Context context,
int defaultColor)
Extracts the primary color from a theme.
|
static int |
getPrimaryDarkColor(android.content.Context context,
int defaultColor)
Extracts the primary dark color from a theme.
|
public static int blendColors(int color1,
int color2,
float ratio)
color1 - ARGB hex code for the first colour to blendcolor2 - ARGB hex code for the second colour to blendratio - the proportion of color1 to use in the blended result, between 0 and 1
(inclusive)java.lang.IllegalArgumentException - if ratio is not between 0 and 1 (inclusive)public static int getPrimaryColor(android.content.Context context,
int defaultColor)
context - the context to get the theme ofdefaultColor - the color to return if no primary color is found, as an ARGB hex codepublic static int getPrimaryDarkColor(android.content.Context context,
int defaultColor)
context - the context to get the theme ofdefaultColor - the color to return if no primary dark color is found, as an ARGB hex codepublic static int getAccentColor(android.content.Context context,
int defaultColor)
context - the context to get the theme ofdefaultColor - the color to return if no accent color is found, as an ARGB hex code