Package org.spongepowered.api.util
Class Color
- java.lang.Object
- 
- org.spongepowered.api.util.Color
 
- 
- All Implemented Interfaces:
- RGBLike,- DataSerializable
 
 public final class Color extends Object implements DataSerializable, RGBLike 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classColor.Builder
 - 
Field SummaryFields Modifier and Type Field Description static ColorBLACKstatic ColorBLUEstatic ColorCYANstatic ColorDARK_CYANstatic ColorDARK_GREENstatic ColorDARK_MAGENTAstatic ColorGRAYstatic ColorGREENstatic ColorLIMEstatic ColorMAGENTAstatic ColorNAVYstatic ColorPINKstatic ColorPURPLEstatic ColorREDstatic ColorWHITEstatic ColorYELLOW
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ColorasJavaColor()@org.checkerframework.common.value.qual.IntRange(from=0L, to=255L) intblue()Gets the currentbluevalue of thisColor.intcontentVersion()Gets the content version of thisDataSerializable.booleanequals(Object obj)@org.checkerframework.common.value.qual.IntRange(from=0L, to=255L) intgreen()Gets theredvalue of thisColor.inthashCode()static ColormixColors(Color... colors)static ColormixDyeColors(DyeColor... colors)ColormixWithColors(Color... colors)Creates a new color with the providedColors.ColormixWithDyes(DyeColor... dyeColors)static Colorof(Color color)static Colorof(Vector3d vector3d)static Colorof(Vector3f vector3f)static Colorof(Vector3i vector3i)static ColorofRgb(int hex)static ColorofRgb(int red, int green, int blue)@org.checkerframework.common.value.qual.IntRange(from=0L, to=255L) intred()Gets theredvalue of thisColor.intrgb()Gets thered green bluerepresentation of this color in a "hexadecimal" format.DataContainertoContainer()Serializes this object into a comprehensibleDataContainer.StringtoString()ColorwithBlue(int blue)ColorwithGreen(int green)ColorwithRed(int red)
 
- 
- 
- 
Field Detail- 
BLACKpublic static final Color BLACK 
 - 
GRAYpublic static final Color GRAY 
 - 
WHITEpublic static final Color WHITE 
 - 
BLUEpublic static final Color BLUE 
 - 
GREENpublic static final Color GREEN 
 - 
LIMEpublic static final Color LIME 
 - 
REDpublic static final Color RED 
 - 
YELLOWpublic static final Color YELLOW 
 - 
MAGENTApublic static final Color MAGENTA 
 - 
PURPLEpublic static final Color PURPLE 
 - 
DARK_CYANpublic static final Color DARK_CYAN 
 - 
DARK_GREENpublic static final Color DARK_GREEN 
 - 
DARK_MAGENTApublic static final Color DARK_MAGENTA 
 - 
CYANpublic static final Color CYAN 
 - 
NAVYpublic static final Color NAVY 
 - 
PINKpublic static final Color PINK 
 
- 
 - 
Method Detail- 
ofRgbpublic static Color ofRgb(int hex) Gets a newColorbased on the hexadecimal value for a combinedred,green, andbluecolor. Note that colors do not utilize an alpha modifier- Parameters:
- hex- The hexadecimal value of the color
- Returns:
- The color object
 
 - 
ofRgbpublic static Color ofRgb(int red, int green, int blue) Gets a newColorbased on the hexadecimal value for a combinedred,green, andbluecolor. Note that colors do not utilize an alpha modifier- Parameters:
- red- The red value
- green- The green value
- blue- The blue value
- Returns:
- The color object
 
 - 
ofpublic static Color of(Color color) - Parameters:
- color- The java color object
- Returns:
- The converted color object
 
 - 
ofpublic static Color of(Vector3i vector3i) - Parameters:
- vector3i- The vector of three integers representing color
- Returns:
- The color object
 
 - 
ofpublic static Color of(Vector3f vector3f) - Parameters:
- vector3f- The vector of three floats representing color
- Returns:
- The color object
 
 - 
ofpublic static Color of(Vector3d vector3d) - Parameters:
- vector3d- The vector of three doubles representing color
- Returns:
- The color object
 
 - 
mixDyeColorspublic static Color mixDyeColors(DyeColor... colors) Creates a newColorcombining the providedDyeColorobjects. SinceDyeColors can be converted intoColorobjects themselves, their summation and average is taken into effect to properly mix the colors together.- Parameters:
- colors- The colors to mix
- Returns:
- The final output mixed color
 
 - 
mixColorspublic static Color mixColors(Color... colors) Creates a newColorcombining the providedColorobjects, their summation and average is taken into effect to properly mix the colors together.- Parameters:
- colors- The colors to mix
- Returns:
- The final output mixed color
 
 - 
redpublic @org.checkerframework.common.value.qual.IntRange(from=0L, to=255L) int red() Gets theredvalue of thisColor.
 - 
withRedpublic Color withRed(int red) Creates a newColorby using the providedredcolor, while retaining the currentgreen()andblue()values.- Parameters:
- red- The red value to use
- Returns:
- The new color object
 
 - 
greenpublic @org.checkerframework.common.value.qual.IntRange(from=0L, to=255L) int green() Gets theredvalue of thisColor.
 - 
withGreenpublic Color withGreen(int green) Creates a newColorby using the providedgreencolor, while retaining the currentred()andblue()values.- Parameters:
- green- The green value to use
- Returns:
- The new color object
 
 - 
bluepublic @org.checkerframework.common.value.qual.IntRange(from=0L, to=255L) int blue() Gets the currentbluevalue of thisColor.
 - 
withBluepublic Color withBlue(int blue) Creates a newColorby using the providedbluecolor, while retaining the currentgreen()andred()values.- Parameters:
- blue- The blue value to use
- Returns:
- The new color object
 
 - 
asJavaColorpublic Color asJavaColor() - Returns:
- The java awt color object
 
 - 
rgbpublic int rgb() Gets thered green bluerepresentation of this color in a "hexadecimal" format.- Returns:
- The current color value in a hexadecimal format
 
 - 
mixWithColorspublic Color mixWithColors(Color... colors) Creates a new color with the providedColors.- Parameters:
- colors- The provided colors to mix
- Returns:
- The new color
 
 - 
mixWithDyespublic Color mixWithDyes(DyeColor... dyeColors) - Parameters:
- dyeColors- The dye colors to mix
- Returns:
- The new color
 
 - 
contentVersionpublic int contentVersion() Description copied from interface:DataSerializableGets the content version of thisDataSerializable. The version may differ between instances of plugins and implementations such that theDataViewfromDataSerializable.toContainer()may include different information, or remove other information as they are no longer deemed necessary. The version goes hand in hand withDataContentUpdateras it is required when there exists anyDataViewof thisDataSerializablewith an "older" version.- Specified by:
- contentVersionin interface- DataSerializable
- Returns:
- The version of the content being serialized
 
 - 
toContainerpublic DataContainer toContainer() Description copied from interface:DataSerializableSerializes this object into a comprehensibleDataContainer.- Specified by:
- toContainerin interface- DataSerializable
- Returns:
- A newly created DataContainer
 
 
- 
 
-