public class ColorUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.awt.Color |
MAX_INT |
static java.awt.Color |
MIN_INT |
| Constructor and Description |
|---|
ColorUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.awt.Color |
colorInterpolate(java.awt.Color a,
java.awt.Color b,
double t)
Interpolates between two colors.
|
static java.awt.Color |
colorInterpolate(java.awt.Color a,
java.awt.Color b,
double tR,
double tG,
double tB,
double tA)
Interpolates between two colors.
|
static java.awt.Color |
fromHex(java.lang.String hex)
Returns a color model from the given hex value.
|
static java.awt.Color |
getRainbow() |
static java.awt.Color |
getRainbow(long delay,
double time)
Returns a rainbow color.
|
static java.awt.Color |
getRainbow(long delay,
double time,
float saturation,
float brightness)
Returns a rainbow color.
|
static java.awt.Color |
invert(java.awt.Color color)
Invert a color
|
static float[] |
rgb(int color)
Splits the given color into an array of floats.
|
static float[] |
rgba(int color)
Splits the given color into an array of floats.
|
static java.lang.String |
toHex(int color)
Returns the hex value of the given color.
|
static int |
toSRGB(float[] rgba)
Merges the given array of floats into a color.
|
static int |
toSRGB(float r,
float g,
float b)
Merges the given array of floats into a color.
|
static int |
toSRGB(float r,
float g,
float b,
float a)
Merges the given array of floats into a color.
|
static java.awt.Color |
withAlpha(java.awt.Color color,
int alpha)
Returns a new color with the given alpha value.
|
static java.awt.Color |
withBlue(java.awt.Color color,
int blue)
Returns a new color with the given blue value.
|
static java.awt.Color |
withGreen(java.awt.Color color,
int green)
Returns a new color with the given green value.
|
static java.awt.Color |
withRed(java.awt.Color color,
int red)
Returns a new color with the given red value.
|
public static final java.awt.Color MIN_INT
public static final java.awt.Color MAX_INT
public static java.awt.Color withRed(java.awt.Color color,
int red)
color - The color to change the red value of.red - The new red value.public static java.awt.Color withGreen(java.awt.Color color,
int green)
color - The color to change the green value of.green - The new red value.public static java.awt.Color withBlue(java.awt.Color color,
int blue)
color - The color to change the blue value of.blue - The new red value.public static java.awt.Color withAlpha(java.awt.Color color,
int alpha)
color - The color to change the alpha value of.alpha - The new alpha value.public static java.awt.Color invert(java.awt.Color color)
color - The color to invertpublic static java.lang.String toHex(int color)
color - The color to convert.public static java.awt.Color fromHex(java.lang.String hex)
hex - The hex value.public static float[] rgb(int color)
color - The color to split.public static float[] rgba(int color)
color - The color to split.public static int toSRGB(float[] rgba)
rgba - The array of floats.public static int toSRGB(float r,
float g,
float b)
r - The red value.g - The green value.b - The blue value.public static int toSRGB(float r,
float g,
float b,
float a)
r - The red value.g - The green value.b - The blue value.a - The alpha value.public static java.awt.Color colorInterpolate(java.awt.Color a,
java.awt.Color b,
double t)
a - The first color.b - The second color.t - The factor to interpolate.public static java.awt.Color colorInterpolate(java.awt.Color a,
java.awt.Color b,
double tR,
double tG,
double tB,
double tA)
a - The first color.b - The second color.tR - The factor to interpolate the red value.tG - The factor to interpolate the green value.tB - The factor to interpolate the blue value.tA - The factor to interpolate the alpha value.public static java.awt.Color getRainbow()
public static java.awt.Color getRainbow(long delay,
double time)
delay - The delay.time - The time.public static java.awt.Color getRainbow(long delay,
double time,
float saturation,
float brightness)
delay - The delay.time - The time.saturation - The saturation.brightness - The brightness.