public class ColorUtils
extends java.lang.Object
| Constructor and Description |
|---|
ColorUtils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
distance(java.awt.Color color1,
java.awt.Color color2)
Get the distance between two colors.
|
static java.awt.Color |
getRainbowColor(int offset,
float divider)
Get a color calculated by the current time.
|
static java.awt.Color |
interpolate(float progress,
java.awt.Color... colors)
Interpolate between multiple colors with a progress.
|
static java.awt.Color |
interpolate(float progress,
java.awt.Color[] colors,
float[] steps)
Interpolate between multiple colors with a progress.
|
static java.awt.Color |
interpolate(float progress,
java.awt.Color color1,
java.awt.Color color2)
Interpolate between two colors with a progress.
|
static java.awt.Color |
invert(java.awt.Color color)
Invert a color.
|
static java.awt.Color |
mix(java.awt.Color color1,
java.awt.Color color2)
Mix two colors together.
|
static java.awt.Color |
multiply(java.awt.Color color,
float factor)
Multiply a color with a factor.
|
static java.awt.Color |
multiply(java.awt.Color color,
float rFactor,
float gFactor,
float bFactor,
float aFactor)
Multiply a color with a factor.
|
static java.awt.Color |
multiplyAll(java.awt.Color color,
float factor)
Multiply a color with a factor.
|
static java.awt.Color |
multiplyAlpha(java.awt.Color color,
float factor)
Multiply the alpha value of a color with a factor.
|
static java.awt.Color |
setAlpha(java.awt.Color color,
int a)
Set the alpha value of a color.
|
static java.awt.Color |
setBlue(java.awt.Color color,
int b)
Set the blue value of a color.
|
static java.awt.Color |
setGreen(java.awt.Color color,
int g)
Set the green value of a color.
|
static java.awt.Color |
setRed(java.awt.Color color,
int r)
Set the red value of a color.
|
public static java.awt.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 timepublic static java.awt.Color setRed(java.awt.Color color,
int r)
color - The color to modifyr - The new red valuepublic static java.awt.Color setGreen(java.awt.Color color,
int g)
color - The color to modifyg - The new green valuepublic static java.awt.Color setBlue(java.awt.Color color,
int b)
color - The color to modifyb - The new blue valuepublic static java.awt.Color setAlpha(java.awt.Color color,
int a)
color - The color to modifya - The new alpha valuepublic static java.awt.Color invert(java.awt.Color color)
color - The color to invertpublic static java.awt.Color multiply(java.awt.Color color,
float factor)
color - The color to multiplyfactor - The factor to multiply withpublic static java.awt.Color multiplyAlpha(java.awt.Color color,
float factor)
color - The color to multiplyfactor - The factor to multiply withpublic static java.awt.Color multiplyAll(java.awt.Color color,
float factor)
color - The color to multiplyfactor - The factor to multiply withpublic static java.awt.Color multiply(java.awt.Color color,
float rFactor,
float gFactor,
float bFactor,
float aFactor)
color - The color to multiplyrFactor - The factor to multiply the red value withgFactor - The factor to multiply the green value withbFactor - The factor to multiply the blue value withaFactor - The factor to multiply the alpha value withpublic static java.awt.Color interpolate(float progress,
java.awt.Color color1,
java.awt.Color color2)
progress - The progress between the two colorscolor1 - The first colorcolor2 - The second colorpublic static java.awt.Color interpolate(float progress,
java.awt.Color[] colors,
float[] steps)
progress - The progress between the colorscolors - The colors to interpolate betweensteps - The steps between the colorspublic static java.awt.Color interpolate(float progress,
java.awt.Color... colors)
progress - The progress between the colorscolors - The colors to interpolate betweenpublic static int distance(java.awt.Color color1,
java.awt.Color color2)
color1 - The first colorcolor2 - The second colorpublic static java.awt.Color mix(java.awt.Color color1,
java.awt.Color color2)
color1 - The first colorcolor2 - The second color