public class Color
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static Color |
BLACK |
static Color |
BLUE |
static Color |
CYAN |
static Color |
DARK_GRAY |
static Color |
GRAY |
static Color |
GREEN |
static Color |
LIGHT_GRAY |
static Color |
MAGENTA |
static Color |
ORANGE |
static Color |
PINK |
static Color |
RED |
static Color |
TRANSPARENT |
static Color |
WHITE |
static Color |
YELLOW |
| Modifier and Type | Method and Description |
|---|---|
Color |
brighter() |
Color |
brighter(float factor)
Brighten this color by the given factor.
|
Color |
darker() |
Color |
darker(float factor)
Darken this color by the given factor.
|
static Color |
directRGBA(int r,
int g,
int b,
int a)
Directly create a color from red, green, blue and alpha values.
|
int |
distance(Color color)
Calculate the distance between this color and another color.
|
boolean |
equals(java.lang.Object o) |
static Color |
fromABGR(int abgr)
Create a color from an int.
|
static Color |
fromABGRF(float[] abgr)
Create a color from a float array.
|
static Color |
fromARGB(int argb)
Create a color from an int.
|
static Color |
fromARGBF(float[] argb)
Create a color from a float array.
|
static Color |
fromAWT(java.awt.Color color)
Create a color from an AWT color.
|
static Color |
fromBGR(int bgr)
Create a color from an int.
|
static Color |
fromBGRA(int bgra)
Create a color from an int.
|
static Color |
fromBGRAF(float[] bgra)
Create a color from a float array.
|
static Color |
fromBGRF(float[] bgr)
Create a color from a float array.
|
static Color |
fromHSB(float[] hsb)
Create a color from a float array.
|
static Color |
fromHSB(float hue,
float saturation,
float brightness)
Create a color from HSB values.
|
static Color |
fromRGB(int rgb)
Create a color from an int.
|
static Color |
fromRGB(int r,
int g,
int b)
Create a color from red, green and blue values.
|
static Color |
fromRGBA(int rgba)
Create a color from an int.
|
static Color |
fromRGBA(int r,
int g,
int b,
int a)
Create a color from red, green, blue and alpha values.
|
static Color |
fromRGBAF(float[] rgba)
Create a color from a float array.
|
static Color |
fromRGBAF(float r,
float g,
float b,
float a)
Create a color from red, green, blue and alpha values.
|
static Color |
fromRGBF(float[] rgb)
Create a color from a float array.
|
static Color |
fromRGBF(float r,
float g,
float b)
Create a color from red, green and blue values.
|
int |
getAlpha() |
float |
getAlphaF() |
int |
getBlue() |
float |
getBlueF() |
int |
getGreen() |
float |
getGreenF() |
static Color |
getRainbowColor(int offset,
float divider)
Get a color calculated by the current time.
|
int |
getRed() |
float |
getRedF() |
int |
hashCode() |
static Color |
interpolate(float progress,
Color... colors)
Interpolate between multiple colors with a progress.
|
static Color |
interpolate(float progress,
Color[] colors,
float[] steps)
Interpolate between multiple colors with a progress.
|
static Color |
interpolate(float progress,
Color color1,
Color color2)
Interpolate between two colors with a progress.
|
Color |
invert()
Invert this color.
|
Color |
multiply(Color color)
Multiply this color with another color.
|
Color |
multiply(float multiplier)
Multiply this color with a factor.
|
Color |
multiplyAll(float multiplier)
Multiply this color with a factor.
|
Color |
multiplyAlpha(float multiplier)
Multiply this colors alpha value with a factor.
|
int |
toABGR() |
float[] |
toABGRF() |
int |
toARGB() |
float[] |
toARGBF() |
java.awt.Color |
toAWT() |
int |
toBGR() |
int |
toBGRA() |
float[] |
toBGRAF() |
float[] |
toBGRF() |
float[] |
toHSB() |
int |
toRGB() |
int |
toRGBA() |
float[] |
toRGBAF() |
float[] |
toRGBF() |
java.lang.String |
toString() |
Color |
withAlpha(int a)
Get a new color with a different alpha value.
|
Color |
withAlphaF(float a)
Get a new color with a different alpha value.
|
Color |
withBlue(int b)
Get a new color with a different blue value.
|
Color |
withBlueF(float b)
Get a new color with a different blue value.
|
Color |
withGreen(int g)
Get a new color with a different green value.
|
Color |
withGreenF(float g)
Get a new color with a different green value.
|
Color |
withRed(int r)
Get a new color with a different red value.
|
Color |
withRedF(float r)
Get a new color with a different red value.
|
public static final Color TRANSPARENT
public static final Color BLACK
public static final Color LIGHT_GRAY
public static final Color GRAY
public static final Color DARK_GRAY
public static final Color WHITE
public static final Color RED
public static final Color GREEN
public static final Color BLUE
public static final Color ORANGE
public static final Color YELLOW
public static final Color CYAN
public static final Color PINK
public static final Color MAGENTA
public static Color fromRGB(int rgb)
rgb - The intpublic static Color fromBGR(int bgr)
bgr - The intpublic static Color fromRGB(int r, int g, int b)
r - The red valueg - The green valueb - The blue valuepublic static Color fromRGBA(int rgba)
rgba - The intpublic static Color fromARGB(int argb)
argb - The intpublic static Color fromBGRA(int bgra)
bgra - The intpublic static Color fromABGR(int abgr)
abgr - The intpublic static Color fromRGBA(int r, int g, int b, int a)
r - The red valueg - The green valueb - The blue valuea - The alpha valuepublic static Color directRGBA(int r, int g, int b, int a)
r - The red valueg - The green valueb - The blue valuea - The alpha valuepublic static Color fromRGBF(float[] rgb)
rgb - The float arraypublic static Color fromBGRF(float[] bgr)
bgr - The float arraypublic static Color fromRGBF(float r, float g, float b)
r - The red valueg - The green valueb - The blue valuepublic static Color fromRGBAF(float[] rgba)
rgba - The float arraypublic static Color fromARGBF(float[] argb)
argb - The float arraypublic static Color fromBGRAF(float[] bgra)
bgra - The float arraypublic static Color fromABGRF(float[] abgr)
abgr - The float arraypublic static Color fromRGBAF(float r, float g, float b, float a)
r - The red valueg - The green valueb - The blue valuea - The alpha valuepublic static Color fromHSB(float[] hsb)
hsb - The float arraypublic static Color fromHSB(float hue, float saturation, float brightness)
hue - The hue valuesaturation - The saturation valuebrightness - The brightness valuepublic static Color fromAWT(java.awt.Color color)
color - The AWT color to convertpublic static Color getRainbowColor(int offset, float divider)
7.5F the color will be the same with the offset of 0 and 7500.offset - The offset added to the current timedivider - The divider for the current timeColorUtils.getRainbowColor(int, float)public static Color interpolate(float progress, Color color1, Color color2)
progress - The progress between the two colorscolor1 - The first colorcolor2 - The second colorColorUtils.interpolate(float, java.awt.Color, java.awt.Color)public static Color interpolate(float progress, Color[] colors, float[] steps)
progress - The progress between the colorscolors - The colors to interpolate betweensteps - The steps between the colorsColorUtils.interpolate(float, java.awt.Color[], float[])public static Color interpolate(float progress, Color... colors)
progress - The progress between the colorscolors - The colors to interpolate betweenColorUtils.interpolate(float, java.awt.Color...)public int getRed()
public float getRedF()
public Color withRed(int r)
r - The new red value between 0 and 255public Color withRedF(float r)
r - The new red value between 0 and 1public int getGreen()
public float getGreenF()
public Color withGreen(int g)
g - The new green value between 0 and 255public Color withGreenF(float g)
g - The new green value between 0 and 1public int getBlue()
public float getBlueF()
public Color withBlue(int b)
b - The new blue value between 0 and 255public Color withBlueF(float b)
b - The new blue value between 0 and 1public int getAlpha()
public float getAlphaF()
public Color withAlpha(int a)
a - The new alpha value between 0 and 255public Color withAlphaF(float a)
a - The new alpha value between 0 and 1public int toRGB()
public int toBGR()
public int toRGBA()
public int toARGB()
public int toBGRA()
public int toABGR()
public float[] toRGBF()
public float[] toBGRF()
public float[] toRGBAF()
public float[] toARGBF()
public float[] toBGRAF()
public float[] toABGRF()
public float[] toHSB()
public java.awt.Color toAWT()
public Color brighter()
public Color brighter(float factor)
factor - The factor to brighten this color bypublic Color darker()
public Color darker(float factor)
factor - The factor to darken this color bypublic Color invert()
public Color multiply(float multiplier)
multiplier - The factor to multiply withpublic Color multiplyAlpha(float multiplier)
multiplier - The factor to multiply withpublic Color multiplyAll(float multiplier)
multiplier - The factor to multiply withpublic Color multiply(Color color)
color - The color to multiply withpublic int distance(Color color)
color - The other colorpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object