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 |
directABGR(int a,
int b,
int g,
int r)
Directly create a color from alpha, blue, green and red values.
This method does not perform bounds checking. |
static Color |
directABGRF(float a,
float b,
float g,
float r)
Directly create a color from alpha, blue, green and red values.
This method does not perform bounds checking. |
static Color |
directARGB(int a,
int r,
int g,
int b)
Directly create a color from alpha, red, green and blue values.
This method does not perform bounds checking. |
static Color |
directARGBF(float a,
float r,
float g,
float b)
Directly create a color from alpha, red, green and blue values.
This method does not perform bounds checking. |
static Color |
directBGR(int b,
int g,
int r)
Directly create a color from blue, green and red values.
This method does not perform bounds checking. |
static Color |
directBGRA(int b,
int g,
int r,
int a)
Directly create a color from blue, green, red and alpha values.
This method does not perform bounds checking. |
static Color |
directBGRAF(float b,
float g,
float r,
float a)
Directly create a color from blue, green, red and alpha values.
This method does not perform bounds checking. |
static Color |
directBGRF(float b,
float g,
float r)
Directly create a color from blue, green and red values.
This method does not perform bounds checking. |
static Color |
directRGB(int r,
int g,
int b)
Directly create a color from red, green and blue values.
This method does not perform bounds checking. |
static Color |
directRGBA(int r,
int g,
int b,
int a)
Directly create a color from red, green, blue and alpha values.
This method does not perform bounds checking. |
static Color |
directRGBAF(float r,
float g,
float b,
float a)
Directly create a color from red, green, blue and alpha values.
This method does not perform bounds checking. |
static Color |
directRGBF(float r,
float g,
float b)
Directly create a color from red, green and blue values.
This method does not perform bounds checking. |
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.
The int must be in the format: 0xAABBGGRR |
static Color |
fromABGR(int a,
int b,
int g,
int r)
Create a color from alpha, blue, green and red values.
The values must be between 0 and 255 (inclusive). |
static Color |
fromABGRF(float[] abgr)
Create a color from a float array.
The array must have a length of 4. The array must contain the values in the order: a, b, g, r The values must be between 0 and 1 (inclusive). |
static Color |
fromABGRF(float a,
float b,
float g,
float r)
Create a color from alpha, blue, green and red values.
The values must be between 0 and 1 (inclusive). |
static Color |
fromARGB(int argb)
Create a color from an int.
The int must be in the format: 0xAARRGGBB |
static Color |
fromARGB(int a,
int r,
int g,
int b)
Create a color from alpha, red, green and blue values.
The values must be between 0 and 255 (inclusive). |
static Color |
fromARGBF(float[] argb)
Create a color from a float array.
The array must have a length of 4. The array must contain the values in the order: a, r, g, b The values must be between 0 and 1 (inclusive). |
static Color |
fromARGBF(float a,
float r,
float g,
float b)
Create a color from alpha, red, green and blue values.
The values must be between 0 and 1 (inclusive). |
static Color |
fromAWT(java.awt.Color color)
Create a color from an AWT color.
The alpha value will be included in the created color. |
static Color |
fromBGR(int bgr)
Create a color from an int.
The int must be in the format: 0xBBGGRR |
static Color |
fromBGR(int b,
int g,
int r)
Create a color from blue, green and red values.
The values must be between 0 and 255 (inclusive). |
static Color |
fromBGRA(int bgra)
Create a color from an int.
The int must be in the format: 0xBBGGRRAA |
static Color |
fromBGRA(int b,
int g,
int r,
int a)
Create a color from blue, green, red and alpha values.
The values must be between 0 and 255 (inclusive). |
static Color |
fromBGRAF(float[] bgra)
Create a color from a float array.
The array must have a length of 4. The array must contain the values in the order: b, g, r, a The values must be between 0 and 1 (inclusive). |
static Color |
fromBGRAF(float b,
float g,
float r,
float a)
Create a color from blue, green, red and alpha values.
The values must be between 0 and 1 (inclusive). |
static Color |
fromBGRF(float[] bgr)
Create a color from a float array.
The array must have a length of 3. The array must contain the values in the order: b, g, r The values must be between 0 and 1 (inclusive). |
static Color |
fromBGRF(float b,
float g,
float r)
Create a color from blue, green and red values.
The values must be between 0 and 1 (inclusive). |
static Color |
fromHSB(float[] hsb)
Create a color from a float array.
The array must have a length of 3. The array must contain the values in the order: h, s, b The values must be between 0 and 1 (inclusive). |
static Color |
fromHSB(float hue,
float saturation,
float brightness)
Create a color from HSB values.
The values must be between 0 and 1. |
static Color |
fromRGB(int rgb)
Create a color from an int.
The int must be in the format: 0xRRGGBB |
static Color |
fromRGB(int r,
int g,
int b)
Create a color from red, green and blue values.
The values must be between 0 and 255 (inclusive). |
static Color |
fromRGBA(int rgba)
Create a color from an int.
The int must be in the format: 0xRRGGBBAA |
static Color |
fromRGBA(int r,
int g,
int b,
int a)
Create a color from red, green, blue and alpha values.
The values must be between 0 and 255 (inclusive). |
static Color |
fromRGBAF(float[] rgba)
Create a color from a float array.
The array must have a length of 4. The array must contain the values in the order: r, g, b, a The values must be between 0 and 1 (inclusive). |
static Color |
fromRGBAF(float r,
float g,
float b,
float a)
Create a color from red, green, blue and alpha values.
The values must be between 0 and 1 (inclusive). |
static Color |
fromRGBF(float[] rgb)
Create a color from a float array.
The array must have a length of 3. The array must contain the values in the order: r, g, b The values must be between 0 and 1 (inclusive). |
static Color |
fromRGBF(float r,
float g,
float b)
Create a color from red, green and blue values.
The values must be between 0 and 1 (inclusive). |
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.
Calling this method subsequently will generate an RGB rainbow color effect. The offset depends on the used divider. |
int |
getRed() |
float |
getRedF() |
int |
hashCode() |
static Color |
interpolate(float progress,
Color... colors)
Interpolate between multiple colors with a progress.
The progress is a value between 0 and 1. The colors must have a length greater than 0. |
static Color |
interpolate(float progress,
Color[] colors,
float[] steps)
Interpolate between multiple colors with a progress.
The progress is a value between 0 and 1. The colors and steps must have the same length. |
static Color |
interpolate(float progress,
Color color1,
Color color2)
Interpolate between two colors with a progress.
The progress is a value between 0 and 1. |
Color |
invert()
Invert this color.
The alpha value will not be changed. |
Color |
multiply(Color color)
Multiply this color with another color.
The values of this color will be multiplied with the float values of the other color. |
Color |
multiply(float multiplier)
Multiply this color with a factor.
The alpha value will not be changed. |
Color |
multiplyAll(float multiplier)
Multiply this color with a factor.
|
Color |
multiplyAlpha(float multiplier)
Multiply this colors alpha value with a factor.
The other values will not be changed. |
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 fromRGB(int r, int g, int b)
r - The red valueg - The green valueb - The blue valuepublic static Color directRGB(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 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 fromARGB(int argb)
argb - The intpublic static Color fromARGB(int a, int r, int g, int b)
a - The alpha valuer - The red valueg - The green valueb - The blue valuepublic static Color directARGB(int a, int r, int g, int b)
a - The alpha valuer - The red valueg - The green valueb - The blue valuepublic static Color fromBGR(int bgr)
bgr - The intpublic static Color fromBGR(int b, int g, int r)
b - The blue valueg - The green valuer - The red valuepublic static Color directBGR(int b, int g, int r)
b - The blue valueg - The green valuer - The red valuepublic static Color fromBGRA(int bgra)
bgra - The intpublic static Color fromBGRA(int b, int g, int r, int a)
b - The blue valueg - The green valuer - The red valuea - The alpha valuepublic static Color directBGRA(int b, int g, int r, int a)
b - The blue valueg - The green valuer - The red valuea - The alpha valuepublic static Color fromABGR(int abgr)
abgr - The intpublic static Color fromABGR(int a, int b, int g, int r)
a - The alpha valueb - The blue valueg - The green valuer - The red valuepublic static Color directABGR(int a, int b, int g, int r)
a - The alpha valueb - The blue valueg - The green valuer - The red valuepublic static Color fromRGBF(float[] rgb)
rgb - The float arraypublic static Color fromRGBF(float r, float g, float b)
r - The red valueg - The green valueb - The blue valuepublic static Color directRGBF(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 fromRGBAF(float r, float g, float b, float a)
r - The red valueg - The green valueb - The blue valuea - The alpha valuepublic static Color directRGBAF(float r, float g, float b, float a)
r - The red valueg - The green valueb - The blue valuea - The alpha valuepublic static Color fromARGBF(float[] argb)
argb - The float arraypublic static Color fromARGBF(float a, float r, float g, float b)
a - The alpha valuer - The red valueg - The green valueb - The blue valuepublic static Color directARGBF(float a, float r, float g, float b)
a - The alpha valuer - The red valueg - The green valueb - The blue valuepublic static Color fromBGRF(float[] bgr)
bgr - The float arraypublic static Color fromBGRF(float b, float g, float r)
b - The blue valueg - The green valuer - The red valuepublic static Color directBGRF(float b, float g, float r)
b - The blue valueg - The green valuer - The red valuepublic static Color fromBGRAF(float[] bgra)
bgra - The float arraypublic static Color fromBGRAF(float b, float g, float r, float a)
b - The blue valueg - The green valuer - The red valuea - The alpha valuepublic static Color directBGRAF(float b, float g, float r, float a)
b - The blue valueg - The green valuer - The red valuea - The alpha valuepublic static Color fromABGRF(float[] abgr)
abgr - The float arraypublic static Color fromABGRF(float a, float b, float g, float r)
a - The alpha valueb - The blue valueg - The green valuer - The red valuepublic static Color directABGRF(float a, float b, float g, float r)
a - The alpha valueb - The blue valueg - The green valuer - The red 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 float[] toRGBF()
public int toRGBA()
public float[] toRGBAF()
public int toARGB()
public float[] toARGBF()
public int toBGR()
public float[] toBGRF()
public int toBGRA()
public float[] toBGRAF()
public int toABGR()
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