Color
Added: 1.0.0
An interface representing RGBA color data. It supports creation via integer ranges, float ranges, or hexadecimal string inputs, and exposes color codes in multiple formats.
Use the static factory create() methods to instantiate new definitions.
Methods
| Return Type | Signature |
|---|---|
Color | static create(int red, int green, int blue) |
Color | static create(int red, int green, int blue, int alpha) |
Color | static create(float red, float green, float blue) |
Color | static create(float red, float green, float blue, float alpha) |
Color | static create(String hex) |
float | getRedFloat() |
float | getGreenFloat() |
float | getBlueFloat() |
float | getAlphaFloat() |
int | getRedInt() |
int | getGreenInt() |
int | getBlueInt() |
int | getAlphaInt() |
int | getARGB() |
int | getRGB() |
Color | copy() |
create
Added: 1.0.0
Static factory methods that instantiate a new instance of Color.
- int channels: Accepts standard color values from
0to255. If alpha is omitted, it defaults to255(fully opaque). - float channels: Accepts normalized decimal values from
0.0fto1.0f. If alpha is omitted, it defaults to1.0f(fully opaque). - hex: Parses a standard hexadecimal string representation (For example,
"#FF5555","FF5555", or with alpha channel variants).
getRedFloat
Added: 1.0.0
Returns the red channel value normalized as a float between 0.0f and 1.0f.
getGreenFloat
Added: 1.0.0
Returns the green channel value normalized as a float between 0.0f and 1.0f.
getBlueFloat
Added: 1.0.0
Returns the blue channel value normalized as a float between 0.0f and 1.0f.
getAlphaFloat
Added: 1.0.0
Returns the alpha opacity channel value normalized as a float between 0.0f and 1.0f.
getRedInt
Added: 1.0.0
Returns the raw red channel value as an integer between 0 and 255.
getGreenInt
Added: 1.0.0
Returns the raw green channel value as an integer between 0 and 255.
getBlueInt
Added: 1.0.0
Returns the raw blue channel value as an integer between 0 and 255.
getAlphaInt
Added: 1.0.0
Returns the raw alpha opacity channel value as an integer between 0 and 255.
getARGB
Added: 1.0.0
Returns an int that packs alpha, red, green and blue values together.
This is the color format used by Minecraft's internal rendering methods.
getRGB
Added: 1.0.0
Returns an int that packs alpha, red, green and blue values together. Alpha is considered 1.0f (fully opaque) in this case.
copy
Added: 1.0.0
Creates and returns a separate copy instance.