Package com.illumon.iris.gui.color
Class Color
java.lang.Object
com.illumon.iris.gui.color.Color
- All Implemented Interfaces:
Paint,Serializable
A color.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Colorstatic Color -
Constructor Summary
ConstructorsConstructorDescriptionColor(float r, float g, float b) Creates a Color with the specified red, green, and blue values in the range (0.0 - 1.0).Color(float r, float g, float b, float a) Creates a Color with the specified red, green, blue, and alpha values in the range (0.0 - 1.0).Color(int rgb) Creates a Color with the specified combinedrgbvalue consisting of the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.Color(int rgba, boolean hasAlpha) Creates a Color with the specified combinedrgbavalue consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.Color(int r, int g, int b) Creates a Color with the specified red, green, and blue values in the range (0 - 255).Color(int r, int g, int b, int a) Creates a Color with the specified red, green, blue, and alpha values in the range (0 - 255).Creates a Color instance represented by thecolorString. -
Method Summary
Modifier and TypeMethodDescriptionstatic ColorCreates a Color instance represented by thecolorString.static ColorcolorHSL(float h, float s, float l) Creates a Color with the specified hue, saturation, lightness, and alpha.static ColorcolorHSL(float h, float s, float l, float a) Creates a Color with the specified hue, saturation, lightness, and alpha.static String[]Gets the names of all available colors.static ColorcolorRGB(float r, float g, float b) Creates a Color with the specified red, green, blue, and alpha values.static ColorcolorRGB(float r, float g, float b, float a) Creates a Color with the specified red, green, blue, and alpha values.static ColorcolorRGB(int rgb) Creates a Color with the specified red, green, blue, and alpha values.static ColorcolorRGB(int rgba, boolean hasAlpha) Creates a Color with the specified red, green, blue, and alpha values.static ColorcolorRGB(int r, int g, int b) Creates a Color with the specified red, green, blue, and alpha values.static ColorcolorRGB(int r, int g, int b, int a) Creates a Color with the specified red, green, blue, and alpha values.booleaninthashCode()Gets the Java object representative of this Paint.toString()static Colorstatic Collection<Color>values()
-
Field Details
-
ALICEBLUE
-
ANTIQUEWHITE
-
AQUA
-
AQUAMARINE
-
AZURE
-
BEIGE
-
BISQUE
-
BLACK
-
BLANCHEDALMOND
-
BLUE
-
BLUEVIOLET
-
BROWN
-
BURLYWOOD
-
CADETBLUE
-
CHARTREUSE
-
CHOCOLATE
-
CORAL
-
CORNFLOWERBLUE
-
CORNSILK
-
CRIMSON
-
CYAN
-
DARKBLUE
-
DARKCYAN
-
DARKGOLDENROD
-
DARKGRAY
-
DARKGREY
-
DARKGREEN
-
DARKKHAKI
-
DARKMAGENTA
-
DARKOLIVEGREEN
-
DARKORANGE
-
DARKORCHID
-
DARKRED
-
DARKSALMON
-
DARKSEAGREEN
-
DARKSLATEBLUE
-
DARKSLATEGRAY
-
DARKSLATEGREY
-
DARKTURQUOISE
-
DARKVIOLET
-
DEEPPINK
-
DEEPSKYBLUE
-
DIMGRAY
-
DIMGREY
-
DODGERBLUE
-
FIREBRICK
-
FLORALWHITE
-
FORESTGREEN
-
FUCHSIA
-
GAINSBORO
-
GHOSTWHITE
-
GOLD
-
GOLDENROD
-
GRAY
-
GREY
-
GREEN
-
GREENYELLOW
-
HONEYDEW
-
HOTPINK
-
INDIANRED
-
INDIGO
-
IVORY
-
KHAKI
-
LAVENDER
-
LAVENDERBLUSH
-
LAWNGREEN
-
LEMONCHIFFON
-
LIGHTBLUE
-
LIGHTCORAL
-
LIGHTCYAN
-
LIGHTGOLDENRODYELLOW
-
LIGHTGRAY
-
LIGHTGREY
-
LIGHTGREEN
-
LIGHTPINK
-
LIGHTSALMON
-
LIGHTSEAGREEN
-
LIGHTSKYBLUE
-
LIGHTSLATEGRAY
-
LIGHTSLATEGREY
-
LIGHTSTEELBLUE
-
LIGHTYELLOW
-
LIME
-
LIMEGREEN
-
LINEN
-
MAGENTA
-
MAROON
-
MEDIUMAQUAMARINE
-
MEDIUMBLUE
-
MEDIUMORCHID
-
MEDIUMPURPLE
-
MEDIUMSEAGREEN
-
MEDIUMSLATEBLUE
-
MEDIUMSPRINGGREEN
-
MEDIUMTURQUOISE
-
MEDIUMVIOLETRED
-
MIDNIGHTBLUE
-
MINTCREAM
-
MISTYROSE
-
MOCCASIN
-
NAVAJOWHITE
-
NAVY
-
OLDLACE
-
OLIVE
-
OLIVEDRAB
-
ORANGE
-
ORANGERED
-
ORCHID
-
PALEGOLDENROD
-
PALEGREEN
-
PALETURQUOISE
-
PALEVIOLETRED
-
PAPAYAWHIP
-
PEACHPUFF
-
PERU
-
PINK
-
PLUM
-
POWDERBLUE
-
PURPLE
-
REBECCAPURPLE
-
RED
-
ROSYBROWN
-
ROYALBLUE
-
SADDLEBROWN
-
SALMON
-
SANDYBROWN
-
SEAGREEN
-
SEASHELL
-
SIENNA
-
SILVER
-
SKYBLUE
-
SLATEBLUE
-
SLATEGRAY
-
SLATEGREY
-
SNOW
-
SPRINGGREEN
-
STEELBLUE
-
TAN
-
TEAL
-
THISTLE
-
TOMATO
-
TURQUOISE
-
VIOLET
-
WHEAT
-
WHITE
-
WHITESMOKE
-
YELLOW
-
YELLOWGREEN
-
VIVID_RED
-
VIVID_YELLOWRED
-
VIVID_YELLOW
-
VIVID_GREENYELLOW
-
VIVID_GREEN
-
VIVID_BLUEGREEN
-
VIVID_BLUE
-
VIVID_PURPLEBLUE
-
VIVID_PURPLE
-
VIVID_REDPURPLE
-
STRONG_RED
-
STRONG_YELLOWRED
-
STRONG_YELLOW
-
STRONG_GREENYELLOW
-
STRONG_GREEN
-
STRONG_BLUEGREEN
-
STRONG_BLUE
-
STRONG_PURPLEBLUE
-
STRONG_PURPLE
-
STRONG_REDPURPLE
-
BRIGHT_RED
-
BRIGHT_YELLOWRED
-
BRIGHT_YELLOW
-
BRIGHT_GREENYELLOW
-
BRIGHT_GREEN
-
BRIGHT_BLUEGREEN
-
BRIGHT_BLUE
-
BRIGHT_PURPLEBLUE
-
BRIGHT_PURPLE
-
BRIGHT_REDPURPLE
-
PALE_RED
-
PALE_YELLOWRED
-
PALE_YELLOW
-
PALE_GREENYELLOW
-
PALE_GREEN
-
PALE_BLUEGREEN
-
PALE_BLUE
-
PALE_PURPLEBLUE
-
PALE_PURPLE
-
PALE_REDPURPLE
-
VERYPALE_RED
-
VERYPALE_YELLOWRED
-
VERYPALE_YELLOW
-
VERYPALE_GREENYELLOW
-
VERYPALE_GREEN
-
VERYPALE_BLUEGREEN
-
VERYPALE_BLUE
-
VERYPALE_PURPLEBLUE
-
VERYPALE_PURPLE
-
VERYPALE_REDPURPLE
-
LIGHTGRAYISH_RED
-
LIGHTGRAYISH_YELLOWRED
-
LIGHTGRAYISH_YELLOW
-
LIGHTGRAYISH_GREENYELLOW
-
LIGHTGRAYISH_GREEN
-
LIGHTGRAYISH_BLUEGREEN
-
LIGHTGRAYISH_BLUE
-
LIGHTGRAYISH_PURPLEBLUE
-
LIGHTGRAYISH_PURPLE
-
LIGHTGRAYISH_REDPURPLE
-
LIGHT_RED
-
LIGHT_YELLOWRED
-
LIGHT_YELLOW
-
LIGHT_GREENYELLOW
-
LIGHT_GREEN
-
LIGHT_BLUEGREEN
-
LIGHT_BLUE
-
LIGHT_PURPLEBLUE
-
LIGHT_PURPLE
-
LIGHT_REDPURPLE
-
GRAYISH_RED
-
GRAYISH_YELLOWRED
-
GRAYISH_YELLOW
-
GRAYISH_GREENYELLOW
-
GRAYISH_GREEN
-
GRAYISH_BLUEGREEN
-
GRAYISH_BLUE
-
GRAYISH_PURPLEBLUE
-
GRAYISH_PURPLE
-
GRAYISH_REDPURPLE
-
DULL_RED
-
DULL_YELLOWRED
-
DULL_YELLOW
-
DULL_GREENYELLOW
-
DULL_GREEN
-
DULL_BLUEGREEN
-
DULL_BLUE
-
DULL_PURPLEBLUE
-
DULL_PURPLE
-
DULL_REDPURPLE
-
DEEP_RED
-
DEEP_YELLOWRED
-
DEEP_YELLOW
-
DEEP_GREENYELLOW
-
DEEP_GREEN
-
DEEP_BLUEGREEN
-
DEEP_BLUE
-
DEEP_PURPLEBLUE
-
DEEP_PURPLE
-
DEEP_REDPURPLE
-
DARK_RED
-
DARK_YELLOWRED
-
DARK_YELLOW
-
DARK_GREENYELLOW
-
DARK_GREEN
-
DARK_BLUEGREEN
-
DARK_BLUE
-
DARK_PURPLEBLUE
-
DARK_PURPLE
-
DARK_REDPURPLE
-
DARKGRAYISH_RED
-
DARKGRAYISH_YELLOWRED
-
DARKGRAYISH_YELLOW
-
DARKGRAYISH_GREENYELLOW
-
DARKGRAYISH_GREEN
-
DARKGRAYISH_BLUEGREEN
-
DARKGRAYISH_BLUE
-
DARKGRAYISH_PURPLEBLUE
-
DARKGRAYISH_PURPLE
-
DARKGRAYISH_REDPURPLE
-
GRAY1
-
GRAY2
-
GRAY3
-
GRAY4
-
GRAY5
-
GRAY6
-
GRAY7
-
GRAY8
-
DB_PINK
-
DB_ORANGE
-
DB_GREEN
-
NO_FORMATTING
-
-
Constructor Details
-
Color
Creates a Color instance represented by thecolorString. Colors are specified by name or hex value. Hex values are parsed as follows: first two digits set the Red component of the color; second two digits set the Green component; third two the Blue. Hex values must have a "#" in front, e.g. "#001122" For available names, seeColorandcolorNames().- Parameters:
color- color; may be hex representation or case-insensitive color name- Throws:
IllegalArgumentException-colormay not be null
-
Color
public Color(int r, int g, int b) Creates a Color with the specified red, green, and blue values in the range (0 - 255). Alpha is defaulted to 255.- Parameters:
r- the red componentg- the green componentb- the blue component- Throws:
IllegalArgumentException- ifr,gorbvalues are outside of the range 0 to 255, inclusive
-
Color
public Color(int r, int g, int b, int a) Creates a Color with the specified red, green, blue, and alpha values in the range (0 - 255). The lower the alpha, the more transparent the color.- Parameters:
r- the red componentg- the green componentb- the blue componenta- the alpha component- Throws:
IllegalArgumentException- ifr,gb, oravalues are outside of the range 0 to 255, inclusive
-
Color
public Color(int rgb) Creates a Color with the specified combinedrgbvalue consisting of the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. Alpha is defaulted to 255.- Parameters:
rgb- the combined RGB components
-
Color
public Color(int rgba, boolean hasAlpha) Creates a Color with the specified combinedrgbavalue consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. IfhasAlphais false, alpha is defaulted to 255.- Parameters:
rgba- the combined rbga componentshasAlpha- if true,rgbais parsed with an alpha component. Otherwise, alpha defaults to 255
-
Color
public Color(float r, float g, float b) Creates a Color with the specified red, green, and blue values in the range (0.0 - 1.0). Alpha is defaulted to 1.0. The lower the alpha, the more transparent the color.- Parameters:
r- the red componentg- the green componentb- the blue component- Throws:
IllegalArgumentException- ifr,gorbvalues are outside of the range 0.0 to 1.0, inclusive
-
Color
public Color(float r, float g, float b, float a) Creates a Color with the specified red, green, blue, and alpha values in the range (0.0 - 1.0). The lower the alpha, the more transparent the color.- Parameters:
r- the red componentg- the green componentb- the blue componenta- the alpha component- Throws:
IllegalArgumentException- ifr,g,b,avalues are outside of the range 0.0 to 1.0, inclusive
-
-
Method Details
-
toString
-
color
Creates a Color instance represented by thecolorString. Colors are specified by name or hex value. Hex values are parsed as follows: first two digits set the Red component of the color; second two digits set the Green component; third two the Blue. Hex values must have a "#" in front, e.g. "#001122" For available names, seeColorandcolorNames()- Parameters:
color- color; may be hex representation or case-insensitive color name- Returns:
- Color instance represented by the
colorString - Throws:
IllegalArgumentException-colormay not be null
-
colorRGB
Creates a Color with the specified red, green, blue, and alpha values.- Parameters:
r- the red component in the range (0 - 255).g- the green component in the range (0 - 255).b- the blue component in the range (0 - 255).- Returns:
- Color with the specified RGB values. Alpha is defaulted to 255.
- Throws:
IllegalArgumentException- ifr,gorbvalues are outside of the range 0 to 255, inclusive
-
colorRGB
Creates a Color with the specified red, green, blue, and alpha values.- Parameters:
r- the red component in the range (0 - 255).g- the green component in the range (0 - 255).b- the blue component in the range (0 - 255).a- the alpha component in the range (0 - 255).- Returns:
- Color with the specified RGBA values
- Throws:
IllegalArgumentException- ifr,gorbvalues are outside of the range 0 to 255, inclusive
-
colorRGB
Creates a Color with the specified red, green, blue, and alpha values.- Parameters:
rgb- the combined rbga components consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. Alpha is defaulted to 255.- Returns:
- Color with the specified RGB value
-
colorRGB
Creates a Color with the specified red, green, blue, and alpha values.- Parameters:
rgba- the combined rbga components consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. IfhasAlphais false, alpha is set to 255.hasAlpha- if true,rgbais parsed with an alpha component. Otherwise, alpha defaults to 255- Returns:
- Color with the specified RGBA value
-
colorRGB
Creates a Color with the specified red, green, blue, and alpha values.- Parameters:
r- the red component in the range (0.0 - 1.0).g- the green component in the range (0.0 - 1.0).b- the blue component in the range (0.0 - 1.0).- Returns:
- Color with the specified RGB values. Alpha is defaulted to 1.0.
- Throws:
IllegalArgumentException- ifr,gorbvalues are outside of the range 0.0 to 1.0, inclusive
-
colorRGB
Creates a Color with the specified red, green, blue, and alpha values.- Parameters:
r- the red component in the range (0.0 - 1.0).g- the green component in the range (0.0 - 1.0).b- the blue component in the range (0.0 - 1.0).a- the alpha component in the range (0.0-1.0). The lower the alpha, the more transparent the color.- Returns:
- Color with the specified RGBA values
- Throws:
IllegalArgumentException- ifr,g,b,avalues are outside of the range 0.0 to 1.0, inclusive
-
colorHSL
Creates a Color with the specified hue, saturation, lightness, and alpha. The lower the alpha, the more transparent the color.- Parameters:
h- the hue component, as a degree on the color wheels- the saturation component, as a percentagel- the lightness component, as a percentage- Returns:
- Color with the specified HSL values. Alpha is defaulted to 1.0.
- Throws:
IllegalArgumentException- ifsorlvalues are outside of the range 0.0 to 100.0, inclusive
-
colorHSL
Creates a Color with the specified hue, saturation, lightness, and alpha. The lower the alpha, the more transparent the color.- Parameters:
h- the hue component, as a degree on the color wheels- the saturation component, as a percentagel- the lightness component, as a percentagea- the alpha component- Returns:
- Color with the specified HSLA values
- Throws:
IllegalArgumentException- ifsorlvalues are outside of the range 0.0 to 100.0, inclusive or ifais outside of the range 0.0 to 1.0, inclusive
-
colorNames
Gets the names of all available colors.- Returns:
- array of names of all available colors
-
javaColor
Description copied from interface:PaintGets the Java object representative of this Paint. -
equals
-
hashCode
public int hashCode() -
valueOf
-
values
-