Package org.spongepowered.api.util
Class Color
java.lang.Object
org.spongepowered.api.util.Color
- All Implemented Interfaces:
RGBLike,DataSerializable
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Color -
Method Summary
Modifier and TypeMethodDescription@org.checkerframework.common.value.qual.IntRange(from=0L, to=255L) intblue()Gets the currentbluevalue of thisColor.intGets the content version of thisDataSerializable.boolean@org.checkerframework.common.value.qual.IntRange(from=0L, to=255L) intgreen()Gets theredvalue of thisColor.inthashCode()static Colorstatic ColormixDyeColors(DyeColor... colors) mixWithColors(Color... colors) Creates a new color with the providedColors.mixWithDyes(DyeColor... dyeColors) static Colorstatic Colorstatic Colorstatic Colorstatic 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.Serializes this object into a comprehensibleDataContainer.toString()withBlue(int blue) withGreen(int green) withRed(int red)
-
Field Details
-
BLACK
-
GRAY
-
WHITE
-
BLUE
-
GREEN
-
LIME
-
RED
-
YELLOW
-
MAGENTA
-
PURPLE
-
DARK_CYAN
-
DARK_GREEN
-
DARK_MAGENTA
-
CYAN
-
NAVY
-
PINK
-
-
Method Details
-
ofRgb
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
-
ofRgb
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 valuegreen- The green valueblue- The blue value- Returns:
- The color object
-
of
- Parameters:
color- The java color object- Returns:
- The converted color object
-
of
- Parameters:
vector3i- The vector of three integers representing color- Returns:
- The color object
-
of
- Parameters:
vector3f- The vector of three floats representing color- Returns:
- The color object
-
of
- Parameters:
vector3d- The vector of three doubles representing color- Returns:
- The color object
-
mixDyeColors
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
-
mixColors
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
-
red
public @org.checkerframework.common.value.qual.IntRange(from=0L, to=255L) int red()Gets theredvalue of thisColor. -
withRed
Creates a newColorby using the providedredcolor, while retaining the currentgreen()andblue()values.- Parameters:
red- The red value to use- Returns:
- The new color object
-
green
public @org.checkerframework.common.value.qual.IntRange(from=0L, to=255L) int green()Gets theredvalue of thisColor. -
withGreen
Creates a newColorby using the providedgreencolor, while retaining the currentred()andblue()values.- Parameters:
green- The green value to use- Returns:
- The new color object
-
blue
public @org.checkerframework.common.value.qual.IntRange(from=0L, to=255L) int blue()Gets the currentbluevalue of thisColor. -
withBlue
Creates a newColorby using the providedbluecolor, while retaining the currentgreen()andred()values.- Parameters:
blue- The blue value to use- Returns:
- The new color object
-
asJavaColor
- Returns:
- The java awt color object
-
rgb
public int rgb()Gets thered green bluerepresentation of this color in a "hexadecimal" format.- Returns:
- The current color value in a hexadecimal format
-
mixWithColors
Creates a new color with the providedColors.- Parameters:
colors- The provided colors to mix- Returns:
- The new color
-
mixWithDyes
- Parameters:
dyeColors- The dye colors to mix- Returns:
- The new color
-
contentVersion
public 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 interfaceDataSerializable- Returns:
- The version of the content being serialized
-
toContainer
Description copied from interface:DataSerializableSerializes this object into a comprehensibleDataContainer.- Specified by:
toContainerin interfaceDataSerializable- Returns:
- A newly created DataContainer
-
hashCode
public int hashCode() -
equals
-
toString
-