public final class Color extends Object implements ConfigurationSerializable
Modifier and Type | Field and Description |
---|---|
static Color |
AQUA
Aqua, or (0x00,0xFF,0xFF) in (R,G,B)
|
static Color |
BLACK
Black, or (0x00,0x00,0x00) in (R,G,B)
|
static Color |
BLUE
Blue, or (0x00,0x00,0xFF) in (R,G,B)
|
static Color |
FUCHSIA
Fuchsia, or (0xFF,0x00,0xFF) in (R,G,B)
|
static Color |
GRAY
Gray, or (0x80,0x80,0x80) in (R,G,B)
|
static Color |
GREEN
Green, or (0x00,0x80,0x00) in (R,G,B)
|
static Color |
LIME
Lime, or (0x00,0xFF,0x00) in (R,G,B)
|
static Color |
MAROON
Maroon, or (0x80,0x00,0x00) in (R,G,B)
|
static Color |
NAVY
Navy, or (0x00,0x00,0x80) in (R,G,B)
|
static Color |
OLIVE
Olive, or (0x80,0x80,0x00) in (R,G,B)
|
static Color |
ORANGE
Orange, or (0xFF,0xA5,0x00) in (R,G,B)
|
static Color |
PURPLE
Purple, or (0x80,0x00,0x80) in (R,G,B)
|
static Color |
RED
Red, or (0xFF,0x00,0x00) in (R,G,B)
|
static Color |
SILVER
Silver, or (0xC0,0xC0,0xC0) in (R,G,B)
|
static Color |
TEAL
Teal, or (0x00,0x80,0x80) in (R,G,B)
|
static Color |
WHITE
White, or (0xFF,0xFF,0xFF) in (R,G,B)
|
static Color |
YELLOW
Yellow, or (0xFF,0xFF,0x00) in (R,G,B)
|
Modifier and Type | Method and Description |
---|---|
int |
asBGR() |
int |
asRGB() |
static Color |
deserialize(Map<String,Object> map) |
boolean |
equals(Object o) |
static Color |
fromBGR(int bgr)
Creates a new color object from an integer that contains the blue,
green, and red bytes in the lowest order 24 bits.
|
static Color |
fromBGR(int blue,
int green,
int red)
Creates a new Color object from a blue, green, and red
|
static Color |
fromRGB(int rgb)
Creates a new color object from an integer that contains the red,
green, and blue bytes in the lowest order 24 bits.
|
static Color |
fromRGB(int red,
int green,
int blue)
Creates a new Color object from a red, green, and blue
|
int |
getBlue()
Gets the blue component
|
int |
getGreen()
Gets the green component
|
int |
getRed()
Gets the red component
|
int |
hashCode() |
Color |
mixColors(Color... colors)
Creates a new color with its RGB components changed as if it was dyed
with the colors passed in, replicating vanilla workbench dyeing
|
Color |
mixDyes(DyeColor... colors)
Creates a new color with its RGB components changed as if it was dyed
with the colors passed in, replicating vanilla workbench dyeing
|
Map<String,Object> |
serialize()
Creates a Map representation of this class.
|
Color |
setBlue(int blue)
Creates a new Color object with specified component
|
Color |
setGreen(int green)
Creates a new Color object with specified component
|
Color |
setRed(int red)
Creates a new Color object with specified component
|
String |
toString() |
public static final Color WHITE
public static final Color SILVER
public static final Color GRAY
public static final Color BLACK
public static final Color RED
public static final Color MAROON
public static final Color YELLOW
public static final Color OLIVE
public static final Color LIME
public static final Color GREEN
public static final Color AQUA
public static final Color TEAL
public static final Color BLUE
public static final Color NAVY
public static final Color FUCHSIA
public static final Color PURPLE
public static final Color ORANGE
public static Color fromRGB(int red, int green, int blue) throws IllegalArgumentException
red
- integer from 0-255green
- integer from 0-255blue
- integer from 0-255IllegalArgumentException
- if any value is strictly >255 or <0public static Color fromBGR(int blue, int green, int red) throws IllegalArgumentException
blue
- integer from 0-255green
- integer from 0-255red
- integer from 0-255IllegalArgumentException
- if any value is strictly >255 or <0public static Color fromRGB(int rgb) throws IllegalArgumentException
rgb
- the integer storing the red, green, and blue valuesIllegalArgumentException
- if any data is in the highest order 8
bitspublic static Color fromBGR(int bgr) throws IllegalArgumentException
bgr
- the integer storing the blue, green, and red valuesIllegalArgumentException
- if any data is in the highest order 8
bitspublic int getRed()
public Color setRed(int red)
red
- the red component, from 0 to 255public int getGreen()
public Color setGreen(int green)
green
- the red component, from 0 to 255public int getBlue()
public Color setBlue(int blue)
blue
- the red component, from 0 to 255public int asRGB()
public int asBGR()
public Color mixDyes(DyeColor... colors)
colors
- The DyeColors to dye withpublic Color mixColors(Color... colors)
colors
- The colors to dye withpublic Map<String,Object> serialize()
ConfigurationSerializable
This class must provide a method to restore this class, as defined in
the ConfigurationSerializable
interface javadocs.
serialize
in interface ConfigurationSerializable
Copyright © 2022. All rights reserved.