java.lang.Object
javafx.scene.paint.Paint
javafx.scene.paint.Color
- All Implemented Interfaces:
- Interpolatable<Color>
public final class Color extends Paint implements Interpolatable<Color>
The Color class is used to encapsulate colors in the default sRGB color space.
 Every color has an implicit alpha value of 1.0 or an explicit one provided
 in the constructor. The alpha value defines the transparency of a color
 and can be  represented by a double value in the range 0.0-1.0 or 0-255.
 An alpha value of 1.0 or 255 means that the color is completely opaque
 and an alpha value of 0 or 0.0 means that the color is completely transparent.
 When constructing a 
Color with an explicit alpha or getting
 the color/alpha components of a Color,
 the color components are never premultiplied by the alpha component.
 Colors can be created with the constructor or with one of several
 utility methods.  The following lines of code all create the same
 blue color:
 
 Color c = Color.BLUE;   //use the blue constant
 Color c = new Color(0,0,1,1.0); // standard constructor, use 0->1.0 values, explicit alpha of 1.0
 Color c = Color.color(0,0,1.0); //use 0->1.0 values. implicit alpha of 1.0
 Color c = Color.color(0,0,1.0,1.0); //use 0->1.0 values, explicit alpha of 1.0
 Color c = Color.rgb(0,0,255); //use 0->255 integers, implicit alpha of 1.0
 Color c = Color.rgb(0,0,255,1.0); //use 0->255 integers, explicit alpha of 1.0
 Color c = Color.hsb(270,1.0,1.0); //hue = 270, saturation & value = 1.0. inplicit alpha of 1.0
 Color c = Color.hsb(270,1.0,1.0,1.0); //hue = 270, saturation & value = 1.0, explicit alpha of 1.0
 Color c = Color.web("0x0000FF",1.0);// blue as a hex web value, explicit alpha
 Color c = Color.web("0x0000FF");// blue as a hex web value, implicit alpha
 Color c = Color.web("0x00F");// blue as a short hex web value, implicit alpha
 Color c = Color.web("#0000FF",1.0);// blue as a hex web value, explicit alpha
 Color c = Color.web("#0000FF");// blue as a hex web value, implicit alpha
 Color c = Color.web("#00F");// blue as a short hex web value, implicit alpha
 Color c = Color.web("0000FF",1.0);// blue as a hex web value, explicit alpha
 Color c = Color.web("0000FF");// blue as a hex web value, implicit alpha
 Color c = Color.web("00F");// blue as a short hex web value, implicit alpha
 Color c = Color.web("rgba(0,0,255,1.0)");// blue as an rgb web value, explicit alpha
 Color c = Color.web("rgb(0,0,255)");// blue as an rgb web value, implicit alpha
 Color c = Color.web("rgba(0,0,100%,1.0)");// blue as an rgb percent web value, explicit alpha
 Color c = Color.web("rgb(0,0,100%)");// blue as an rgb percent web value, implicit alpha
 Color c = Color.web("hsla(270,100%,100%,1.0)");// blue as an hsl web value, explicit alpha
 Color c = Color.web("hsl(270,100%,100%)");// blue as an hsl web value, implicit alpha
 
 
 The creation of a Color will throw IllegalArgumentException if any
 of the values are out of range.
 
For example:
 Rectangle rec1 = new Rectangle(5, 5, 50, 40);
 rec1.setFill(Color.RED);
 rec1.setStroke(Color.GREEN);
 rec1.setStrokeWidth(3);
 Rectangle rec2 = new Rectangle(65, 5, 50, 40);
 rec2.setFill(Color.rgb(91, 127, 255));
 rec2.setStroke(Color.hsb(40, 0.7, 0.8));
 rec2.setStrokeWidth(3);
 - Since:
- JavaFX 2.0
- 
Field SummaryFields Modifier and Type Field Description static ColorALICEBLUEThe color alice blue with an RGB value of #F0F8FFstatic ColorANTIQUEWHITEThe color antique white with an RGB value of #FAEBD7static ColorAQUAThe color aqua with an RGB value of #00FFFFstatic ColorAQUAMARINEThe color aquamarine with an RGB value of #7FFFD4static ColorAZUREThe color azure with an RGB value of #F0FFFFstatic ColorBEIGEThe color beige with an RGB value of #F5F5DCstatic ColorBISQUEThe color bisque with an RGB value of #FFE4C4static ColorBLACKThe color black with an RGB value of #000000static ColorBLANCHEDALMONDThe color blanched almond with an RGB value of #FFEBCDstatic ColorBLUEThe color blue with an RGB value of #0000FFstatic ColorBLUEVIOLETThe color blue violet with an RGB value of #8A2BE2static ColorBROWNThe color brown with an RGB value of #A52A2Astatic ColorBURLYWOODThe color burly wood with an RGB value of #DEB887static ColorCADETBLUEThe color cadet blue with an RGB value of #5F9EA0static ColorCHARTREUSEThe color chartreuse with an RGB value of #7FFF00static ColorCHOCOLATEThe color chocolate with an RGB value of #D2691Estatic ColorCORALThe color coral with an RGB value of #FF7F50static ColorCORNFLOWERBLUEThe color cornflower blue with an RGB value of #6495EDstatic ColorCORNSILKThe color cornsilk with an RGB value of #FFF8DCstatic ColorCRIMSONThe color crimson with an RGB value of #DC143Cstatic ColorCYANThe color cyan with an RGB value of #00FFFFstatic ColorDARKBLUEThe color dark blue with an RGB value of #00008Bstatic ColorDARKCYANThe color dark cyan with an RGB value of #008B8Bstatic ColorDARKGOLDENRODThe color dark goldenrod with an RGB value of #B8860Bstatic ColorDARKGRAYThe color dark gray with an RGB value of #A9A9A9static ColorDARKGREENThe color dark green with an RGB value of #006400static ColorDARKGREYThe color dark grey with an RGB value of #A9A9A9static ColorDARKKHAKIThe color dark khaki with an RGB value of #BDB76Bstatic ColorDARKMAGENTAThe color dark magenta with an RGB value of #8B008Bstatic ColorDARKOLIVEGREENThe color dark olive green with an RGB value of #556B2Fstatic ColorDARKORANGEThe color dark orange with an RGB value of #FF8C00static ColorDARKORCHIDThe color dark orchid with an RGB value of #9932CCstatic ColorDARKREDThe color dark red with an RGB value of #8B0000static ColorDARKSALMONThe color dark salmon with an RGB value of #E9967Astatic ColorDARKSEAGREENThe color dark sea green with an RGB value of #8FBC8Fstatic ColorDARKSLATEBLUEThe color dark slate blue with an RGB value of #483D8Bstatic ColorDARKSLATEGRAYThe color dark slate gray with an RGB value of #2F4F4Fstatic ColorDARKSLATEGREYThe color dark slate grey with an RGB value of #2F4F4Fstatic ColorDARKTURQUOISEThe color dark turquoise with an RGB value of #00CED1static ColorDARKVIOLETThe color dark violet with an RGB value of #9400D3static ColorDEEPPINKThe color deep pink with an RGB value of #FF1493static ColorDEEPSKYBLUEThe color deep sky blue with an RGB value of #00BFFFstatic ColorDIMGRAYThe color dim gray with an RGB value of #696969static ColorDIMGREYThe color dim grey with an RGB value of #696969static ColorDODGERBLUEThe color dodger blue with an RGB value of #1E90FFstatic ColorFIREBRICKThe color firebrick with an RGB value of #B22222static ColorFLORALWHITEThe color floral white with an RGB value of #FFFAF0static ColorFORESTGREENThe color forest green with an RGB value of #228B22static ColorFUCHSIAThe color fuchsia with an RGB value of #FF00FFstatic ColorGAINSBOROThe color gainsboro with an RGB value of #DCDCDCstatic ColorGHOSTWHITEThe color ghost white with an RGB value of #F8F8FFstatic ColorGOLDThe color gold with an RGB value of #FFD700static ColorGOLDENRODThe color goldenrod with an RGB value of #DAA520static ColorGRAYThe color gray with an RGB value of #808080static ColorGREENThe color green with an RGB value of #008000static ColorGREENYELLOWThe color green yellow with an RGB value of #ADFF2Fstatic ColorGREYThe color grey with an RGB value of #808080static ColorHONEYDEWThe color honeydew with an RGB value of #F0FFF0static ColorHOTPINKThe color hot pink with an RGB value of #FF69B4static ColorINDIANREDThe color indian red with an RGB value of #CD5C5Cstatic ColorINDIGOThe color indigo with an RGB value of #4B0082static ColorIVORYThe color ivory with an RGB value of #FFFFF0static ColorKHAKIThe color khaki with an RGB value of #F0E68Cstatic ColorLAVENDERThe color lavender with an RGB value of #E6E6FAstatic ColorLAVENDERBLUSHThe color lavender blush with an RGB value of #FFF0F5static ColorLAWNGREENThe color lawn green with an RGB value of #7CFC00static ColorLEMONCHIFFONThe color lemon chiffon with an RGB value of #FFFACDstatic ColorLIGHTBLUEThe color light blue with an RGB value of #ADD8E6static ColorLIGHTCORALThe color light coral with an RGB value of #F08080static ColorLIGHTCYANThe color light cyan with an RGB value of #E0FFFFstatic ColorLIGHTGOLDENRODYELLOWThe color light goldenrod yellow with an RGB value of #FAFAD2static ColorLIGHTGRAYThe color light gray with an RGB value of #D3D3D3static ColorLIGHTGREENThe color light green with an RGB value of #90EE90static ColorLIGHTGREYThe color light grey with an RGB value of #D3D3D3static ColorLIGHTPINKThe color light pink with an RGB value of #FFB6C1static ColorLIGHTSALMONThe color light salmon with an RGB value of #FFA07Astatic ColorLIGHTSEAGREENThe color light sea green with an RGB value of #20B2AAstatic ColorLIGHTSKYBLUEThe color light sky blue with an RGB value of #87CEFAstatic ColorLIGHTSLATEGRAYThe color light slate gray with an RGB value of #778899static ColorLIGHTSLATEGREYThe color light slate grey with an RGB value of #778899static ColorLIGHTSTEELBLUEThe color light steel blue with an RGB value of #B0C4DEstatic ColorLIGHTYELLOWThe color light yellow with an RGB value of #FFFFE0static ColorLIMEThe color lime with an RGB value of #00FF00static ColorLIMEGREENThe color lime green with an RGB value of #32CD32static ColorLINENThe color linen with an RGB value of #FAF0E6static ColorMAGENTAThe color magenta with an RGB value of #FF00FFstatic ColorMAROONThe color maroon with an RGB value of #800000static ColorMEDIUMAQUAMARINEThe color medium aquamarine with an RGB value of #66CDAAstatic ColorMEDIUMBLUEThe color medium blue with an RGB value of #0000CDstatic ColorMEDIUMORCHIDThe color medium orchid with an RGB value of #BA55D3static ColorMEDIUMPURPLEThe color medium purple with an RGB value of #9370DBstatic ColorMEDIUMSEAGREENThe color medium sea green with an RGB value of #3CB371static ColorMEDIUMSLATEBLUEThe color medium slate blue with an RGB value of #7B68EEstatic ColorMEDIUMSPRINGGREENThe color medium spring green with an RGB value of #00FA9Astatic ColorMEDIUMTURQUOISEThe color medium turquoise with an RGB value of #48D1CCstatic ColorMEDIUMVIOLETREDThe color medium violet red with an RGB value of #C71585static ColorMIDNIGHTBLUEThe color midnight blue with an RGB value of #191970static ColorMINTCREAMThe color mint cream with an RGB value of #F5FFFAstatic ColorMISTYROSEThe color misty rose with an RGB value of #FFE4E1static ColorMOCCASINThe color moccasin with an RGB value of #FFE4B5static ColorNAVAJOWHITEThe color navajo white with an RGB value of #FFDEADstatic ColorNAVYThe color navy with an RGB value of #000080static ColorOLDLACEThe color old lace with an RGB value of #FDF5E6static ColorOLIVEThe color olive with an RGB value of #808000static ColorOLIVEDRABThe color olive drab with an RGB value of #6B8E23static ColorORANGEThe color orange with an RGB value of #FFA500static ColorORANGEREDThe color orange red with an RGB value of #FF4500static ColorORCHIDThe color orchid with an RGB value of #DA70D6static ColorPALEGOLDENRODThe color pale goldenrod with an RGB value of #EEE8AAstatic ColorPALEGREENThe color pale green with an RGB value of #98FB98static ColorPALETURQUOISEThe color pale turquoise with an RGB value of #AFEEEEstatic ColorPALEVIOLETREDThe color pale violet red with an RGB value of #DB7093static ColorPAPAYAWHIPThe color papaya whip with an RGB value of #FFEFD5static ColorPEACHPUFFThe color peach puff with an RGB value of #FFDAB9static ColorPERUThe color peru with an RGB value of #CD853Fstatic ColorPINKThe color pink with an RGB value of #FFC0CBstatic ColorPLUMThe color plum with an RGB value of #DDA0DDstatic ColorPOWDERBLUEThe color powder blue with an RGB value of #B0E0E6static ColorPURPLEThe color purple with an RGB value of #800080static ColorREDThe color red with an RGB value of #FF0000static ColorROSYBROWNThe color rosy brown with an RGB value of #BC8F8Fstatic ColorROYALBLUEThe color royal blue with an RGB value of #4169E1static ColorSADDLEBROWNThe color saddle brown with an RGB value of #8B4513static ColorSALMONThe color salmon with an RGB value of #FA8072static ColorSANDYBROWNThe color sandy brown with an RGB value of #F4A460static ColorSEAGREENThe color sea green with an RGB value of #2E8B57static ColorSEASHELLThe color sea shell with an RGB value of #FFF5EEstatic ColorSIENNAThe color sienna with an RGB value of #A0522Dstatic ColorSILVERThe color silver with an RGB value of #C0C0C0static ColorSKYBLUEThe color sky blue with an RGB value of #87CEEBstatic ColorSLATEBLUEThe color slate blue with an RGB value of #6A5ACDstatic ColorSLATEGRAYThe color slate gray with an RGB value of #708090static ColorSLATEGREYThe color slate grey with an RGB value of #708090static ColorSNOWThe color snow with an RGB value of #FFFAFAstatic ColorSPRINGGREENThe color spring green with an RGB value of #00FF7Fstatic ColorSTEELBLUEThe color steel blue with an RGB value of #4682B4static ColorTANThe color tan with an RGB value of #D2B48Cstatic ColorTEALThe color teal with an RGB value of #008080static ColorTHISTLEThe color thistle with an RGB value of #D8BFD8static ColorTOMATOThe color tomato with an RGB value of #FF6347static ColorTRANSPARENTA fully transparent color with an ARGB value of #00000000.static ColorTURQUOISEThe color turquoise with an RGB value of #40E0D0static ColorVIOLETThe color violet with an RGB value of #EE82EEstatic ColorWHEATThe color wheat with an RGB value of #F5DEB3static ColorWHITEThe color white with an RGB value of #FFFFFFstatic ColorWHITESMOKEThe color white smoke with an RGB value of #F5F5F5static ColorYELLOWThe color yellow with an RGB value of #FFFF00static ColorYELLOWGREENThe color yellow green with an RGB value of #9ACD32
- 
Constructor SummaryConstructors Constructor Description Color(double red, double green, double blue, double opacity)Creates aColorwith the specified red, green, blue, and alpha values in the range 0.0-1.0.
- 
Method SummaryModifier and Type Method Description Colorbrighter()Creates a new Color that is a brighter version of this Color.static Colorcolor(double red, double green, double blue)Creates an opaque sRGB color with the specified red, green and blue values in the range0.0-1.0.static Colorcolor(double red, double green, double blue, double opacity)Creates an sRGB color with the specified red, green and blue values in the range0.0-1.0, and a given opacity.Colordarker()Creates a new Color that is a darker version of this Color.ColorderiveColor(double hueShift, double saturationFactor, double brightnessFactor, double opacityFactor)Creates a newColorbased on thisColorwith hue, saturation, brightness and opacity values altered.Colordesaturate()Creates a new Color that is a less saturated version of this Color.booleanequals(Object obj)Indicates whether some other object is "equal to" this one.doublegetBlue()The blue component of theColor, in the range0.0-1.0.doublegetBrightness()Gets the brightness component of thisColor.doublegetGreen()The green component of theColor, in the range0.0-1.0.doublegetHue()Gets the hue component of thisColor.doublegetOpacity()The opacity of theColor, in the range0.0-1.0.doublegetRed()The red component of theColor, in the range0.0-1.0.doublegetSaturation()Gets the saturation component of thisColor.static Colorgray(double gray)Creates an opaque grey color.static Colorgray(double gray, double opacity)Creates a grey color.static ColorgrayRgb(int gray)This is a shortcut forrgb(gray, gray, gray).static ColorgrayRgb(int gray, double opacity)This is a shortcut forrgb(gray, gray, gray, opacity).Colorgrayscale()Creates a new Color that is grayscale equivalent of this Color.inthashCode()Returns a hash code for thisColorobject.static Colorhsb(double hue, double saturation, double brightness)Creates an opaqueColorbased on the specified values in the HSB color model.static Colorhsb(double hue, double saturation, double brightness, double opacity)Creates aColorbased on the specified values in the HSB color model, and a given opacity.Colorinvert()Creates a new Color that is inversion of this Color.booleanisOpaque()Gets whether this Paint is completely opaque.static Colorrgb(int red, int green, int blue)Creates an opaque sRGB color with the specified RGB values in the range0-255.static Colorrgb(int red, int green, int blue, double opacity)Creates an sRGB color with the specified RGB values in the range0-255, and a given opacity.Colorsaturate()Creates a new Color that is a more saturated version of this Color.StringtoString()Returns a string representation of thisColor.static ColorvalueOf(String value)Creates a color value from a string representation.static Colorweb(String colorString)Creates an RGB color specified with an HTML or CSS attribute string.static Colorweb(String colorString, double opacity)Creates an RGB color specified with an HTML or CSS attribute string.Methods declared in class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods declared in interface javafx.animation.Interpolatableinterpolate
- 
Field Details- 
TRANSPARENTA fully transparent color with an ARGB value of #00000000.
- 
ALICEBLUEThe color alice blue with an RGB value of #F0F8FF
- 
ANTIQUEWHITEThe color antique white with an RGB value of #FAEBD7
- 
AQUAThe color aqua with an RGB value of #00FFFF
- 
AQUAMARINEThe color aquamarine with an RGB value of #7FFFD4
- 
AZUREThe color azure with an RGB value of #F0FFFF
- 
BEIGEThe color beige with an RGB value of #F5F5DC
- 
BISQUEThe color bisque with an RGB value of #FFE4C4
- 
BLACKThe color black with an RGB value of #000000
- 
BLANCHEDALMONDThe color blanched almond with an RGB value of #FFEBCD
- 
BLUEThe color blue with an RGB value of #0000FF
- 
BLUEVIOLETThe color blue violet with an RGB value of #8A2BE2
- 
BROWNThe color brown with an RGB value of #A52A2A
- 
BURLYWOODThe color burly wood with an RGB value of #DEB887
- 
CADETBLUEThe color cadet blue with an RGB value of #5F9EA0
- 
CHARTREUSEThe color chartreuse with an RGB value of #7FFF00
- 
CHOCOLATEThe color chocolate with an RGB value of #D2691E
- 
CORALThe color coral with an RGB value of #FF7F50
- 
CORNFLOWERBLUEThe color cornflower blue with an RGB value of #6495ED
- 
CORNSILKThe color cornsilk with an RGB value of #FFF8DC
- 
CRIMSONThe color crimson with an RGB value of #DC143C
- 
CYANThe color cyan with an RGB value of #00FFFF
- 
DARKBLUEThe color dark blue with an RGB value of #00008B
- 
DARKCYANThe color dark cyan with an RGB value of #008B8B
- 
DARKGOLDENRODThe color dark goldenrod with an RGB value of #B8860B
- 
DARKGRAYThe color dark gray with an RGB value of #A9A9A9
- 
DARKGREENThe color dark green with an RGB value of #006400
- 
DARKGREYThe color dark grey with an RGB value of #A9A9A9
- 
DARKKHAKIThe color dark khaki with an RGB value of #BDB76B
- 
DARKMAGENTAThe color dark magenta with an RGB value of #8B008B
- 
DARKOLIVEGREENThe color dark olive green with an RGB value of #556B2F
- 
DARKORANGEThe color dark orange with an RGB value of #FF8C00
- 
DARKORCHIDThe color dark orchid with an RGB value of #9932CC
- 
DARKREDThe color dark red with an RGB value of #8B0000
- 
DARKSALMONThe color dark salmon with an RGB value of #E9967A
- 
DARKSEAGREENThe color dark sea green with an RGB value of #8FBC8F
- 
DARKSLATEBLUEThe color dark slate blue with an RGB value of #483D8B
- 
DARKSLATEGRAYThe color dark slate gray with an RGB value of #2F4F4F
- 
DARKSLATEGREYThe color dark slate grey with an RGB value of #2F4F4F
- 
DARKTURQUOISEThe color dark turquoise with an RGB value of #00CED1
- 
DARKVIOLETThe color dark violet with an RGB value of #9400D3
- 
DEEPPINKThe color deep pink with an RGB value of #FF1493
- 
DEEPSKYBLUEThe color deep sky blue with an RGB value of #00BFFF
- 
DIMGRAYThe color dim gray with an RGB value of #696969
- 
DIMGREYThe color dim grey with an RGB value of #696969
- 
DODGERBLUEThe color dodger blue with an RGB value of #1E90FF
- 
FIREBRICKThe color firebrick with an RGB value of #B22222
- 
FLORALWHITEThe color floral white with an RGB value of #FFFAF0
- 
FORESTGREENThe color forest green with an RGB value of #228B22
- 
FUCHSIAThe color fuchsia with an RGB value of #FF00FF
- 
GAINSBOROThe color gainsboro with an RGB value of #DCDCDC
- 
GHOSTWHITEThe color ghost white with an RGB value of #F8F8FF
- 
GOLDThe color gold with an RGB value of #FFD700
- 
GOLDENRODThe color goldenrod with an RGB value of #DAA520
- 
GRAYThe color gray with an RGB value of #808080
- 
GREENThe color green with an RGB value of #008000
- 
GREENYELLOWThe color green yellow with an RGB value of #ADFF2F
- 
GREYThe color grey with an RGB value of #808080
- 
HONEYDEWThe color honeydew with an RGB value of #F0FFF0
- 
HOTPINKThe color hot pink with an RGB value of #FF69B4
- 
INDIANREDThe color indian red with an RGB value of #CD5C5C
- 
INDIGOThe color indigo with an RGB value of #4B0082
- 
IVORYThe color ivory with an RGB value of #FFFFF0
- 
KHAKIThe color khaki with an RGB value of #F0E68C
- 
LAVENDERThe color lavender with an RGB value of #E6E6FA
- 
LAVENDERBLUSHThe color lavender blush with an RGB value of #FFF0F5
- 
LAWNGREENThe color lawn green with an RGB value of #7CFC00
- 
LEMONCHIFFONThe color lemon chiffon with an RGB value of #FFFACD
- 
LIGHTBLUEThe color light blue with an RGB value of #ADD8E6
- 
LIGHTCORALThe color light coral with an RGB value of #F08080
- 
LIGHTCYANThe color light cyan with an RGB value of #E0FFFF
- 
LIGHTGOLDENRODYELLOWThe color light goldenrod yellow with an RGB value of #FAFAD2
- 
LIGHTGRAYThe color light gray with an RGB value of #D3D3D3
- 
LIGHTGREENThe color light green with an RGB value of #90EE90
- 
LIGHTGREYThe color light grey with an RGB value of #D3D3D3
- 
LIGHTPINKThe color light pink with an RGB value of #FFB6C1
- 
LIGHTSALMONThe color light salmon with an RGB value of #FFA07A
- 
LIGHTSEAGREENThe color light sea green with an RGB value of #20B2AA
- 
LIGHTSKYBLUEThe color light sky blue with an RGB value of #87CEFA
- 
LIGHTSLATEGRAYThe color light slate gray with an RGB value of #778899
- 
LIGHTSLATEGREYThe color light slate grey with an RGB value of #778899
- 
LIGHTSTEELBLUEThe color light steel blue with an RGB value of #B0C4DE
- 
LIGHTYELLOWThe color light yellow with an RGB value of #FFFFE0
- 
LIMEThe color lime with an RGB value of #00FF00
- 
LIMEGREENThe color lime green with an RGB value of #32CD32
- 
LINENThe color linen with an RGB value of #FAF0E6
- 
MAGENTAThe color magenta with an RGB value of #FF00FF
- 
MAROONThe color maroon with an RGB value of #800000
- 
MEDIUMAQUAMARINEThe color medium aquamarine with an RGB value of #66CDAA
- 
MEDIUMBLUEThe color medium blue with an RGB value of #0000CD
- 
MEDIUMORCHIDThe color medium orchid with an RGB value of #BA55D3
- 
MEDIUMPURPLEThe color medium purple with an RGB value of #9370DB
- 
MEDIUMSEAGREENThe color medium sea green with an RGB value of #3CB371
- 
MEDIUMSLATEBLUEThe color medium slate blue with an RGB value of #7B68EE
- 
MEDIUMSPRINGGREENThe color medium spring green with an RGB value of #00FA9A
- 
MEDIUMTURQUOISEThe color medium turquoise with an RGB value of #48D1CC
- 
MEDIUMVIOLETREDThe color medium violet red with an RGB value of #C71585
- 
MIDNIGHTBLUEThe color midnight blue with an RGB value of #191970
- 
MINTCREAMThe color mint cream with an RGB value of #F5FFFA
- 
MISTYROSEThe color misty rose with an RGB value of #FFE4E1
- 
MOCCASINThe color moccasin with an RGB value of #FFE4B5
- 
NAVAJOWHITEThe color navajo white with an RGB value of #FFDEAD
- 
NAVYThe color navy with an RGB value of #000080
- 
OLDLACEThe color old lace with an RGB value of #FDF5E6
- 
OLIVEThe color olive with an RGB value of #808000
- 
OLIVEDRABThe color olive drab with an RGB value of #6B8E23
- 
ORANGEThe color orange with an RGB value of #FFA500
- 
ORANGEREDThe color orange red with an RGB value of #FF4500
- 
ORCHIDThe color orchid with an RGB value of #DA70D6
- 
PALEGOLDENRODThe color pale goldenrod with an RGB value of #EEE8AA
- 
PALEGREENThe color pale green with an RGB value of #98FB98
- 
PALETURQUOISEThe color pale turquoise with an RGB value of #AFEEEE
- 
PALEVIOLETREDThe color pale violet red with an RGB value of #DB7093
- 
PAPAYAWHIPThe color papaya whip with an RGB value of #FFEFD5
- 
PEACHPUFFThe color peach puff with an RGB value of #FFDAB9
- 
PERUThe color peru with an RGB value of #CD853F
- 
PINKThe color pink with an RGB value of #FFC0CB
- 
PLUMThe color plum with an RGB value of #DDA0DD
- 
POWDERBLUEThe color powder blue with an RGB value of #B0E0E6
- 
PURPLEThe color purple with an RGB value of #800080
- 
REDThe color red with an RGB value of #FF0000
- 
ROSYBROWNThe color rosy brown with an RGB value of #BC8F8F
- 
ROYALBLUEThe color royal blue with an RGB value of #4169E1
- 
SADDLEBROWNThe color saddle brown with an RGB value of #8B4513
- 
SALMONThe color salmon with an RGB value of #FA8072
- 
SANDYBROWNThe color sandy brown with an RGB value of #F4A460
- 
SEAGREENThe color sea green with an RGB value of #2E8B57
- 
SEASHELLThe color sea shell with an RGB value of #FFF5EE
- 
SIENNAThe color sienna with an RGB value of #A0522D
- 
SILVERThe color silver with an RGB value of #C0C0C0
- 
SKYBLUEThe color sky blue with an RGB value of #87CEEB
- 
SLATEBLUEThe color slate blue with an RGB value of #6A5ACD
- 
SLATEGRAYThe color slate gray with an RGB value of #708090
- 
SLATEGREYThe color slate grey with an RGB value of #708090
- 
SNOWThe color snow with an RGB value of #FFFAFA
- 
SPRINGGREENThe color spring green with an RGB value of #00FF7F
- 
STEELBLUEThe color steel blue with an RGB value of #4682B4
- 
TANThe color tan with an RGB value of #D2B48C
- 
TEALThe color teal with an RGB value of #008080
- 
THISTLEThe color thistle with an RGB value of #D8BFD8
- 
TOMATOThe color tomato with an RGB value of #FF6347
- 
TURQUOISEThe color turquoise with an RGB value of #40E0D0
- 
VIOLETThe color violet with an RGB value of #EE82EE
- 
WHEATThe color wheat with an RGB value of #F5DEB3
- 
WHITEThe color white with an RGB value of #FFFFFF
- 
WHITESMOKEThe color white smoke with an RGB value of #F5F5F5
- 
YELLOWThe color yellow with an RGB value of #FFFF00
- 
YELLOWGREENThe color yellow green with an RGB value of #9ACD32
 
- 
- 
Constructor Details- 
Colorpublic Color(double red, double green, double blue, double opacity)Creates aColorwith the specified red, green, blue, and alpha values in the range 0.0-1.0.- Parameters:
- red- red component ranging from- 0to- 1
- green- green component ranging from- 0to- 1
- blue- blue component ranging from- 0to- 1
- opacity- opacity ranging from- 0to- 1
 
 
- 
- 
Method Details- 
colorCreates an sRGB color with the specified red, green and blue values in the range0.0-1.0, and a given opacity.- Parameters:
- red- the red component, in the range- 0.0-1.0
- green- the green component, in the range- 0.0-1.0
- blue- the blue component, in the range- 0.0-1.0
- opacity- the opacity component, in the range- 0.0-1.0
- Returns:
- the Color
- Throws:
- IllegalArgumentException- if any value is out of range
 
- 
colorCreates an opaque sRGB color with the specified red, green and blue values in the range0.0-1.0.- Parameters:
- red- the red component, in the range- 0.0-1.0
- green- the green component, in the range- 0.0-1.0
- blue- the blue component, in the range- 0.0-1.0
- Returns:
- the Color
- Throws:
- IllegalArgumentException- if any value is out of range
 
- 
rgbCreates an sRGB color with the specified RGB values in the range0-255, and a given opacity.- Parameters:
- red- the red component, in the range- 0-255
- green- the green component, in the range- 0-255
- blue- the blue component, in the range- 0-255
- opacity- the opacity component, in the range- 0.0-1.0
- Returns:
- the Color
- Throws:
- IllegalArgumentException- if any value is out of range
 
- 
rgbCreates an opaque sRGB color with the specified RGB values in the range0-255.- Parameters:
- red- the red component, in the range- 0-255
- green- the green component, in the range- 0-255
- blue- the blue component, in the range- 0-255
- Returns:
- the Color
- Throws:
- IllegalArgumentException- if any value is out of range
 
- 
grayRgbThis is a shortcut forrgb(gray, gray, gray).- Parameters:
- gray- the gray component, in the range- 0-255
- Returns:
- the Color
 
- 
grayRgbThis is a shortcut forrgb(gray, gray, gray, opacity).- Parameters:
- gray- the gray component, in the range- 0-255
- opacity- the opacity component, in the range- 0.0-1.0
- Returns:
- the Color
 
- 
grayCreates a grey color.- Parameters:
- gray- color on gray scale in the range- 0.0(black) -- 1.0(white).
- opacity- the opacity component, in the range- 0.0-1.0
- Returns:
- the Color
- Throws:
- IllegalArgumentException- if any value is out of range
 
- 
grayCreates an opaque grey color.- Parameters:
- gray- color on gray scale in the range- 0.0(black) -- 1.0(white).
- Returns:
- the Color
- Throws:
- IllegalArgumentException- if any value is out of range
 
- 
hsbCreates aColorbased on the specified values in the HSB color model, and a given opacity.- Parameters:
- hue- the hue, in degrees
- saturation- the saturation,- 0.0 to 1.0
- brightness- the brightness,- 0.0 to 1.0
- opacity- the opacity,- 0.0 to 1.0
- Returns:
- the Color
- Throws:
- IllegalArgumentException- if- saturation,- brightnessor- opacityare out of range
 
- 
hsbCreates an opaqueColorbased on the specified values in the HSB color model.- Parameters:
- hue- the hue, in degrees
- saturation- the saturation,- 0.0 to 1.0
- brightness- the brightness,- 0.0 to 1.0
- Returns:
- the Color
- Throws:
- IllegalArgumentException- if- saturationor- brightnessare out of range
 
- 
webCreates an RGB color specified with an HTML or CSS attribute string.This method supports the following formats: - Any standard HTML color name
- An HTML long or short format hex string with an optional hex alpha
 channel.
 Hexadecimal values may be preceded by either "0x"or"#"and can either be 2 digits in the range00to0xFFor a single digit in the range0toF.
- An rgb(r,g,b)orrgba(r,g,b,a)format string. Each of ther,g, orbvalues can be an integer from 0 to 255 or a floating point percentage value from 0.0 to 100.0 followed by the percent (%) character. The alpha component, if present, is a floating point value from 0.0 to 1.0. Spaces are allowed before or after the numbers and between the percentage number and its percent sign (%).
- An hsl(h,s,l)orhsla(h,s,l,a)format string. Thehvalue is a floating point number from 0.0 to 360.0 representing the hue angle on a color wheel in degrees with0.0or360.0representing red,120.0representing green, and240.0representing blue. Thesvalue is the saturation of the desired color represented as a floating point percentage from gray (0.0) to the fully saturated color (100.0) and thelvalue is the desired lightness or brightness of the desired color represented as a floating point percentage from black (0.0) to the full brightness of the color (100.0). The alpha component, if present, is a floating point value from 0.0 to 1.0. Spaces are allowed before or after the numbers and between the percentage number and its percent sign (%).
 For formats without an alpha component and for named colors, opacity is set according to the opacityargument. For colors specified with an alpha component, the resulting opacity is a combination of the parsed alpha component and theopacityargument, so a transparent color becomes more transparent by specifying opacity.Examples: Web Color Format Table Web Format String Equivalent constructor or factory call Color.web("orange", 0.5);new Color(1.0, 0xA5/255.0, 0.0, 0.5)Color.web("0xff66cc33", 0.5);new Color(1.0, 0.4, 0.8, 0.1)Color.web("0xff66cc", 0.5);new Color(1.0, 0.4, 0.8, 0.5)Color.web("#ff66cc", 0.5);new Color(1.0, 0.4, 0.8, 0.5)Color.web("#f68", 0.5);new Color(1.0, 0.4, 0.8, 0.5)Color.web("rgb(255,102,204)", 0.5);new Color(1.0, 0.4, 0.8, 0.5)Color.web("rgb(100%,50%,50%)", 0.5);new Color(1.0, 0.5, 0.5, 0.5)Color.web("rgb(255,50%,50%,0.25)", 0.5);new Color(1.0, 0.5, 0.5, 0.125)Color.web("hsl(240,100%,100%)", 0.5);Color.hsb(240.0, 1.0, 1.0, 0.5)Color.web("hsla(120,0%,0%,0.25)", 0.5);Color.hsb(120.0, 0.0, 0.0, 0.125)- Parameters:
- colorString- the name or numeric representation of the color in one of the supported formats
- opacity- the opacity component in range from 0.0 (transparent) to 1.0 (opaque)
- Returns:
- the RGB color specified with the colorString
- Throws:
- NullPointerException- if- colorStringis- null
- IllegalArgumentException- if- colorStringspecifies an unsupported color name or contains an illegal numeric value
 
- 
webCreates an RGB color specified with an HTML or CSS attribute string.This method supports the following formats: - Any standard HTML color name
- An HTML long or short format hex string with an optional hex alpha
 channel.
 Hexadecimal values may be preceded by either "0x"or"#"and can either be 2 digits in the range00to0xFFor a single digit in the range0toF.
- An rgb(r,g,b)orrgba(r,g,b,a)format string. Each of ther,g, orbvalues can be an integer from 0 to 255 or a floating point percentage value from 0.0 to 100.0 followed by the percent (%) character. The alpha component, if present, is a floating point value from 0.0 to 1.0. Spaces are allowed before or after the numbers and between the percentage number and its percent sign (%).
- An hsl(h,s,l)orhsla(h,s,l,a)format string. Thehvalue is a floating point number from 0.0 to 360.0 representing the hue angle on a color wheel in degrees with0.0or360.0representing red,120.0representing green, and240.0representing blue. Thesvalue is the saturation of the desired color represented as a floating point percentage from gray (0.0) to the fully saturated color (100.0) and thelvalue is the desired lightness or brightness of the desired color represented as a floating point percentage from black (0.0) to the full brightness of the color (100.0). The alpha component, if present, is a floating point value from 0.0 to 1.0. Spaces are allowed before or after the numbers and between the percentage number and its percent sign (%).
 Examples: Web Color Format Table Web Format String Equivalent constant or factory call Color.web("orange");Color.ORANGEColor.web("0xff668840");Color.rgb(255, 102, 136, 0.25)Color.web("0xff6688");Color.rgb(255, 102, 136, 1.0)Color.web("#ff6688");Color.rgb(255, 102, 136, 1.0)Color.web("#f68");Color.rgb(255, 102, 136, 1.0)Color.web("rgb(255,102,136)");Color.rgb(255, 102, 136, 1.0)Color.web("rgb(100%,50%,50%)");Color.rgb(255, 128, 128, 1.0)Color.web("rgb(255,50%,50%,0.25)");Color.rgb(255, 128, 128, 0.25)Color.web("hsl(240,100%,100%)");Color.hsb(240.0, 1.0, 1.0, 1.0)Color.web("hsla(120,0%,0%,0.25)");Color.hsb(120.0, 0.0, 0.0, 0.25)- Parameters:
- colorString- the name or numeric representation of the color in one of the supported formats
- Returns:
- an RGB color
- Throws:
- NullPointerException- if- colorStringis- null
- IllegalArgumentException- if- colorStringspecifies an unsupported color name or contains an illegal numeric value
 
- 
valueOfCreates a color value from a string representation. The format of the string representation is the same as inweb(String).- Parameters:
- value- the string to convert
- Returns:
- a Colorobject holding the value represented by the string argument
- Throws:
- NullPointerException- if the- valueis- null
- IllegalArgumentException- if the- valuespecifies an unsupported color name or illegal hexadecimal value
- Since:
- JavaFX 2.1
- See Also:
- web(String)
 
- 
getHuepublic double getHue()Gets the hue component of thisColor.- Returns:
- Hue value in the range in the range 0.0-360.0.
 
- 
getSaturationpublic double getSaturation()Gets the saturation component of thisColor.- Returns:
- Saturation value in the range in the range 0.0-1.0.
 
- 
getBrightnesspublic double getBrightness()Gets the brightness component of thisColor.- Returns:
- Brightness value in the range in the range 0.0-1.0.
 
- 
deriveColorpublic Color deriveColor(double hueShift, double saturationFactor, double brightnessFactor, double opacityFactor)Creates a newColorbased on thisColorwith hue, saturation, brightness and opacity values altered. Hue is shifted about the given value and normalized into its natural range, the other components' values are multiplied by the given factors and clipped into their ranges. Increasing brightness of black color is allowed by using an arbitrary, very small source brightness instead of zero.- Parameters:
- hueShift- the hue shift
- saturationFactor- the saturation factor
- brightnessFactor- the brightness factor
- opacityFactor- the opacity factor
- Returns:
- a Colorbased based on thisColorwith hue, saturation, brightness and opacity values altered.
 
- 
brighterCreates a new Color that is a brighter version of this Color.- Returns:
- a Color that is a brighter version of this Color
 
- 
darkerCreates a new Color that is a darker version of this Color.- Returns:
- a Color that is a darker version of this Color
 
- 
saturateCreates a new Color that is a more saturated version of this Color.- Returns:
- a Color that is a more saturated version of this Color
 
- 
desaturateCreates a new Color that is a less saturated version of this Color.- Returns:
- a Color that is a less saturated version of this Color
 
- 
grayscaleCreates a new Color that is grayscale equivalent of this Color. Opacity is preserved.- Returns:
- a Color that is grayscale equivalent of this Color
 
- 
invertCreates a new Color that is inversion of this Color. Opacity is preserved.- Returns:
- a Color that is inversion of this Color
 
- 
getRedpublic final double getRed()The red component of theColor, in the range0.0-1.0.- Default value:
- 0.0
- Returns:
- the red component of the Color, in the range0.0-1.0
 
- 
getGreenpublic final double getGreen()The green component of theColor, in the range0.0-1.0.- Default value:
- 0.0
- Returns:
- the green component of the Color, in the range0.0-1.0
 
- 
getBluepublic final double getBlue()The blue component of theColor, in the range0.0-1.0.- Default value:
- 0.0
- Returns:
- the blue component of the Color, in the range0.0-1.0
 
- 
getOpacitypublic final double getOpacity()The opacity of theColor, in the range0.0-1.0.- Default value:
- 1.0
- Returns:
- the opacity of the Color, in the range0.0-1.0
 
- 
isOpaquepublic final boolean isOpaque()Gets whether this Paint is completely opaque. An opaque paint is one that has no alpha component in any of its colors. It may be possible for a Paint to be opaque and yet return false, if it cannot be easily determined whether the paint is actually opaque. For example, the ImagePattern may not be able to cheaply determine its opacity.
- 
equalsIndicates whether some other object is "equal to" this one.
- 
hashCodepublic int hashCode()Returns a hash code for thisColorobject.
- 
toStringReturns a string representation of thisColor. This method is intended to be used only for informational purposes. The content and format of the returned string might vary between implementations. The returned string might be empty but cannot benull.
 
-