Class AlphaColor
java.lang.Object
net.minestom.server.color.Color
net.minestom.server.color.AlphaColor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AlphaColorstatic final NetworkBuffer.Type<ARGBLike> Deprecated.static final AlphaColorstatic final AlphaColorFields inherited from class Color
RGB_BYTE_NETWORK_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionAlphaColor(float alpha, float red, float green, float blue) AlphaColor(int argb) Creates an alpha color from an integer.AlphaColor(int alpha, int red, int green, int blue) AlphaColor(int alpha, RGBLike rgbLike) Creates a color from an RGB-like color. -
Method Summary
Modifier and TypeMethodDescriptionintalpha()intasARGB()Gets the color as an ARGB integer.intasRGBA()Gets the color as an RGBA integer.booleanstatic @Nullable AlphaColorfromARGBHexString(String hexARGB) Attempt to parse a color from a#-prefixed hex string.static AlphaColorfromARGBLike(ARGBLike argbLike) static @Nullable AlphaColorfromRGBAHexString(String hexRGBA) Attempt to parse a color from a#-prefixed hex string.inthashCode()toString()withAlpha(int alpha) withBlue(int blue) withGreen(int green) withRed(int red)
-
Field Details
-
NETWORK_TYPE
-
CODEC
-
STRING_CODEC
Deprecated.UseRGBA_STRING_CODECorARGB_STRING_CODECinstead. This codec uses RGBA. -
RGBA_STRING_CODEC
-
ARGB_STRING_CODEC
-
WHITE
-
BLACK
-
TRANSPARENT
-
-
Constructor Details
-
AlphaColor
public AlphaColor(float alpha, float red, float green, float blue) -
AlphaColor
public AlphaColor(int alpha, int red, int green, int blue) -
AlphaColor
public AlphaColor(int argb) Creates an alpha color from an integer. This is done by reading each color component from the lowest order 32 bits of the integer, and creating a color from those components.- Parameters:
argb- the integer
-
AlphaColor
Creates a color from an RGB-like color.- Parameters:
rgbLike- the color
-
-
Method Details
-
fromARGBLike
-
withRed
-
withGreen
-
withBlue
-
withAlpha
-
asARGB
public int asARGB()Gets the color as an ARGB integer.- Returns:
- An integer representation of this color, as 0xAARRGGBB
-
asRGBA
public int asRGBA()Gets the color as an RGBA integer.- Returns:
- An integer representation of this color, as 0xRRGGBBAA
-
fromRGBAHexString
@Nullable public static @Nullable AlphaColor fromRGBAHexString(@Pattern("#[0-9a-fA-F]{8}") String hexRGBA) Attempt to parse a color from a#-prefixed hex string.This string must be in the format
#RRGGBBAA.- Parameters:
hexRGBA- the input value- Returns:
- a color if possible, or null if any components are invalid
-
fromARGBHexString
@Nullable public static @Nullable AlphaColor fromARGBHexString(@Pattern("#[0-9a-fA-F]{8}") String hexARGB) Attempt to parse a color from a#-prefixed hex string.This string must be in the format
#AARRGGBB.- Parameters:
hexARGB- the input value- Returns:
- a color if possible, or null if any components are invalid
-
alpha
-
equals
-
hashCode
-
toString
-