public final class Color extends Object implements DataSerializable
Modifier and Type | Class and Description |
---|---|
static class |
Color.Builder |
Modifier and Type | Field and Description |
---|---|
static Color |
BLACK |
static Color |
BLUE |
static Color |
CYAN |
static Color |
DARK_CYAN |
static Color |
DARK_GREEN |
static Color |
DARK_MAGENTA |
static Color |
GRAY |
static Color |
GREEN |
static Color |
LIME |
static Color |
MAGENTA |
static Color |
NAVY |
static Color |
PINK |
static Color |
PURPLE |
static Color |
RED |
static Color |
WHITE |
static Color |
YELLOW |
Modifier and Type | Method and Description |
---|---|
Color |
asJavaColor()
|
boolean |
equals(Object obj) |
int |
getBlue()
Gets the current
blue value of this Color . |
int |
getContentVersion()
Gets the content version of this
DataSerializable . |
int |
getGreen()
Gets the
red value of this Color . |
int |
getRed()
Gets the
red value of this Color . |
int |
getRgb()
Gets the
red green blue representation of this color in
a "hexadecimal" format. |
int |
hashCode() |
static Color |
mixColors(Color... colors)
|
static Color |
mixDyeColors(DyeColor... colors)
|
Color |
mixWithColors(Color... colors)
Creates a new color with the provided
Colors . |
Color |
mixWithDyes(DyeColor... dyeColors)
|
static Color |
of(Color color)
|
static Color |
of(com.flowpowered.math.vector.Vector3d vector3d)
converts the provided
Vector3d into a Color object. |
static Color |
of(com.flowpowered.math.vector.Vector3f vector3f)
converts the provided
Vector3f into a Color object. |
static Color |
of(com.flowpowered.math.vector.Vector3i vector3i)
Converts the provided
Vector3i into a Color object. |
static Color |
ofRgb(int hex)
|
static Color |
ofRgb(int red,
int green,
int blue)
|
DataContainer |
toContainer()
Serializes this object into a comprehensible
DataContainer . |
String |
toString() |
Color |
withBlue(int blue)
Creates a new
Color by using the provided
blue color, while retaining the current getGreen()
and getRed() ()} values. |
Color |
withGreen(int green)
|
Color |
withRed(int red)
Creates a new
Color by using the provided
red color, while retaining the current getGreen()
and getBlue() values. |
public static final Color BLACK
public static final Color GRAY
public static final Color WHITE
public static final Color BLUE
public static final Color GREEN
public static final Color LIME
public static final Color RED
public static final Color YELLOW
public static final Color MAGENTA
public static final Color PURPLE
public static final Color DARK_CYAN
public static final Color DARK_GREEN
public static final Color DARK_MAGENTA
public static final Color CYAN
public static final Color NAVY
public static final Color PINK
public static Color ofRgb(int hex)
Color
based on the hexadecimal value
for a combined red
, green
, and blue
color. Note that colors do not utilize an alpha modifierhex
- The hexadecimal value of the colorpublic static Color ofRgb(int red, int green, int blue)
Color
based on the hexadecimal value
for a combined red
, green
, and blue
color. Note that colors do not utilize an alpha modifierred
- The red valuegreen
- The green valueblue
- The blue valuepublic static Color of(Color color)
color
- The java color objectpublic static Color of(com.flowpowered.math.vector.Vector3i vector3i)
Vector3i
into a Color
object.vector3i
- The vector of three integers representing colorpublic static Color of(com.flowpowered.math.vector.Vector3f vector3f)
Vector3f
into a Color
object.vector3f
- The vector of three floats representing colorpublic static Color of(com.flowpowered.math.vector.Vector3d vector3d)
Vector3d
into a Color
object.vector3d
- The vector of three doubles representing colorpublic static Color mixDyeColors(DyeColor... colors)
Color
combining the provided DyeColor
objects. Since DyeColor
s can be converted into Color
objects themselves, their summation and average is taken into effect
to properly mix the colors together.colors
- The colors to mixpublic static Color mixColors(Color... colors)
Color
combining the provided Color
objects, their summation and average is taken into effect
to properly mix the colors together.colors
- The colors to mixpublic int getRed()
red
value of this Color
.public Color withRed(int red)
Color
by using the provided
red
color, while retaining the current getGreen()
and getBlue()
values.red
- The red value to usepublic int getGreen()
red
value of this Color
.public Color withGreen(int green)
Color
by using the provided
green
color, while retaining the current getRed()
and getBlue()
values.green
- The green value to usepublic int getBlue()
blue
value of this Color
.public Color withBlue(int blue)
Color
by using the provided
blue
color, while retaining the current getGreen()
and getRed()
()} values.blue
- The blue value to usepublic Color asJavaColor()
public int getRgb()
red green blue
representation of this color in
a "hexadecimal" format.public Color mixWithColors(Color... colors)
Colors
.colors
- The provided colors to mixpublic Color mixWithDyes(DyeColor... dyeColors)
dyeColors
- The dye colors to mixpublic int getContentVersion()
DataSerializable
DataSerializable
. The version
may differ between instances of plugins and implementations such that
the DataView
from DataSerializable.toContainer()
may include different
information, or remove other information as they are no longer deemed
necessary. The version goes hand in hand with DataContentUpdater
as it is required when there exists any DataView
of this
DataSerializable
with an "older" version.getContentVersion
in interface DataSerializable
public DataContainer toContainer()
DataSerializable
DataContainer
.toContainer
in interface DataSerializable