public class ColorUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
areContrasting(java.awt.Color c1,
java.awt.Color c2) |
static java.awt.Color |
brighter(java.awt.Color color,
int tones) |
static java.awt.Color |
darker(java.awt.Color color,
int tones) |
static java.awt.Color |
desaturate(java.awt.Color color,
int tones) |
static java.awt.Color |
dimmer(java.awt.Color color) |
static java.awt.Color |
fromHex(java.lang.String str)
Return Color object from string.
|
static java.awt.Color |
fromHex(java.lang.String str,
java.awt.Color defaultValue) |
static double |
getContrast(java.awt.Color c1,
java.awt.Color c2)
Contrast ratios can range from 1 to 21 (commonly written 1:1 to 21:1).
|
static double |
getLuminance(java.awt.Color color) |
static java.awt.Color |
hackBrightness(java.awt.Color color,
int howMuch,
float hackValue) |
static java.awt.Color |
hackBrightness(int r,
int g,
int b,
int howMuch,
float hackValue) |
static boolean |
isDark(java.awt.Color c) |
static java.awt.Color |
marker(java.lang.String name) |
static java.awt.Color |
mix(java.awt.Color c1,
java.awt.Color c2,
double balance) |
static java.awt.Color |
saturate(java.awt.Color color,
int tones) |
static java.awt.Color |
shift(java.awt.Color c,
double d) |
static java.awt.Color |
softer(java.awt.Color color) |
static java.awt.Color |
toAlpha(java.awt.Color color,
int a) |
static java.lang.String |
toHex(java.awt.Color c) |
static java.lang.String |
toHex(java.awt.Color c,
boolean withAlpha) |
static java.lang.String |
toHtmlColor(java.awt.Color c) |
static java.awt.Color |
withAlpha(java.awt.Color c,
double a) |
static java.awt.Color |
withPreAlpha(java.awt.Color c,
double a) |
public static java.awt.Color marker(java.lang.String name)
public static java.awt.Color softer(java.awt.Color color)
public static java.awt.Color darker(java.awt.Color color, int tones)
public static java.awt.Color brighter(java.awt.Color color, int tones)
public static java.awt.Color hackBrightness(java.awt.Color color, int howMuch, float hackValue)
public static java.awt.Color hackBrightness(int r, int g, int b, int howMuch, float hackValue)
public static java.awt.Color saturate(java.awt.Color color, int tones)
public static java.awt.Color desaturate(java.awt.Color color, int tones)
public static java.awt.Color dimmer(java.awt.Color color)
public static java.awt.Color shift(java.awt.Color c, double d)
public static java.awt.Color withAlpha(java.awt.Color c, double a)
public static java.awt.Color withPreAlpha(java.awt.Color c, double a)
public static java.awt.Color toAlpha(java.awt.Color color, int a)
public static java.lang.String toHex(java.awt.Color c)
public static java.lang.String toHex(java.awt.Color c, boolean withAlpha)
public static java.lang.String toHtmlColor(java.awt.Color c)
public static java.awt.Color fromHex(java.lang.String str)
0xA1B2C3
,
#abc123
,
ABC123
,
ab5
,
#FFF
.str
- hex stringpublic static java.awt.Color fromHex(java.lang.String str, java.awt.Color defaultValue)
public static boolean isDark(java.awt.Color c)
c
- color to checkpublic static boolean areContrasting(java.awt.Color c1, java.awt.Color c2)
public static double getContrast(java.awt.Color c1, java.awt.Color c2)
public static double getLuminance(java.awt.Color color)
public static java.awt.Color mix(java.awt.Color c1, java.awt.Color c2, double balance)