Usage
- Typescript Import Format
- //This class is exported directly as module. To import it
 import Color= require("ojs/ojcolor");
For additional information visit:
Final classes in JET
Classes in JET are generally final and do not support subclassing. At the moment, final is not enforced. However, this will likely change in an upcoming JET release.
Constructor
new Color(color)
        Creates an object representing a color. The color may be defined using
the RGB, HSL, and HSV model values as an object, or as a CSS3 color specification string (refer to
https://developer.mozilla.org/en-US/docs/Web/CSS/color_value, and also
https://www.w3.org/TR/css3-color/#svg-color for color visualization.  The
CSS3 named colors are available as Color constants (e.g. Color.ALICEBLUE)
        
    
    
    
    
    
    
    
    
    
    
        Parameters:
| Name | Type | Description | 
|---|---|---|
| color | string | Color.RGBA | Color.HSLA | Color.HSVA | 
 | 
Throws:
    if the color specification cannot be parsed correctly.
- Type
- Error
Fields
- 
    
    (static) ALICEBLUE :Color
- 
    
      CSS3 coloraliceblue
- 
    
    (static) ANTIQUEWHITE :Color
- 
    
      CSS3 colorantiquewhite
- 
    
    (static) AQUA :Color
- 
    
      CSS3 coloraqua
- 
    
    (static) AQUAMARINE :Color
- 
    
      CSS3 coloraquamarine
- 
    
    (static) AZURE :Color
- 
    
      CSS3 colorazure
- 
    
    (static) BEIGE :Color
- 
    
      CSS3 colorbeige
- 
    
    (static) BISQUE :Color
- 
    
      CSS3 colorbisque
- 
    
    (static) BLACK :Color
- 
    
      CSS3 colorblack
- 
    
    (static) BLANCHEDALMOND :Color
- 
    
      CSS3 colorblanchedalmond
- 
    
    (static) BLUE :Color
- 
    
      CSS3 colorblue
- 
    
    (static) BLUEVIOLET :Color
- 
    
      CSS3 colorblueviolet
- 
    
    (static) BROWN :Color
- 
    
      CSS3 colorbrown
- 
    
    (static) BURLYWOOD :Color
- 
    
      CSS3 colorburlywood
- 
    
    (static) CADETBLUE :Color
- 
    
      CSS3 colorcadetblue
- 
    
    (static) CHARTREUSE :Color
- 
    
      CSS3 colorchartreuse
- 
    
    (static) CHOCOLATE :Color
- 
    
      CSS3 colorchocolate
- 
    
    (static) CORAL :Color
- 
    
      CSS3 colorcoral
- 
    
    (static) CORNFLOWERBLUE :Color
- 
    
      CSS3 colorcornflowerblue
- 
    
    (static) CORNSILK :Color
- 
    
      CSS3 colorcornsilk
- 
    
    (static) CRIMSON :Color
- 
    
      CSS3 colorcrimson
- 
    
    (static) CYAN :Color
- 
    
      CSS3 colorcyan
- 
    
    (static) DARKBLUE :Color
- 
    
      CSS3 colordarkblue
- 
    
    (static) DARKCYAN :Color
- 
    
      CSS3 colordarkcyan
- 
    
    (static) DARKGOLDENROD :Color
- 
    
      CSS3 colordarkgoldenrod
- 
    
    (static) DARKGRAY :Color
- 
    
      CSS3 colordarkgray
- 
    
    (static) DARKGREEN :Color
- 
    
      CSS3 colordarkgreen
- 
    
    (static) DARKGREY :Color
- 
    
      CSS3 colordarkgrey
- 
    
    (static) DARKKHAKI :Color
- 
    
      CSS3 colordarkkhaki
- 
    
    (static) DARKMAGENTA :Color
- 
    
      CSS3 colordarkmagenta
- 
    
    (static) DARKOLIVEGREEN :Color
- 
    
      CSS3 colordarkolivegreen
- 
    
    (static) DARKORANGE :Color
- 
    
      CSS3 colordarkorange
- 
    
    (static) DARKORCHID :Color
- 
    
      CSS3 colordarkorchid
- 
    
    (static) DARKRED :Color
- 
    
      CSS3 colordarkred
- 
    
    (static) DARKSALMON :Color
- 
    
      CSS3 colordarksalmon
- 
    
    (static) DARKSEAGREEN :Color
- 
    
      CSS3 colordarkseagreen
- 
    
    (static) DARKSLATEBLUE :Color
- 
    
      CSS3 colordarkslateblue
- 
    
    (static) DARKSLATEGRAY :Color
- 
    
      CSS3 colordarkslategray
- 
    
    (static) DARKSLATEGREY :Color
- 
    
      CSS3 colordarkslategrey
- 
    
    (static) DARKTURQUOISE :Color
- 
    
      CSS3 colordarkturquoise
- 
    
    (static) DARKVIOLET :Color
- 
    
      CSS3 colordarkviolet
- 
    
    (static) DEEPPINK :Color
- 
    
      CSS3 colordeeppink
- 
    
    (static) DEEPSKYBLUE :Color
- 
    
      CSS3 colordeepskyblue
- 
    
    (static) DIMGRAY :Color
- 
    
      CSS3 colordimgray
- 
    
    (static) DIMGREY :Color
- 
    
      CSS3 colordimgrey
- 
    
    (static) DODGERBLUE :Color
- 
    
      CSS3 colordodgerblue
- 
    
    (static) FIREBRICK :Color
- 
    
      CSS3 colorfirebrick
- 
    
    (static) FLORALWHITE :Color
- 
    
      CSS3 colorfloralwhite
- 
    
    (static) FORESTGREEN :Color
- 
    
      CSS3 colorforestgreen
- 
    
    (static) FUCHSIA :Color
- 
    
      CSS3 colorfuchsia
- 
    
    (static) GAINSBORO :Color
- 
    
      CSS3 colorgainsboro
- 
    
    (static) GHOSTWHITE :Color
- 
    
      CSS3 colorghostwhite
- 
    
    (static) GOLD :Color
- 
    
      CSS3 colorgold
- 
    
    (static) GOLDENROD :Color
- 
    
      CSS3 colorgoldenrod
- 
    
    (static) GRAY :Color
- 
    
      CSS3 colorgray
- 
    
    (static) GREEN :Color
- 
    
      CSS3 colorgreen
- 
    
    (static) GREENYELLOW :Color
- 
    
      CSS3 colorgreenyellow
- 
    
    (static) GREY :Color
- 
    
      CSS3 colorgrey
- 
    
    (static) HONEYDEW :Color
- 
    
      CSS3 colorhoneydew
- 
    
    (static) HOTPINK :Color
- 
    
      CSS3 colorhotpink
- 
    
    (static) INDIANRED :Color
- 
    
      CSS3 colorindianred
- 
    
    (static) INDIGO :Color
- 
    
      CSS3 colorindigo
- 
    
    (static) IVORY :Color
- 
    
      CSS3 colorivory
- 
    
    (static) KHAKI :Color
- 
    
      CSS3 colorkhaki
- 
    
    (static) LAVENDER :Color
- 
    
      CSS3 colorlavender
- 
    
    (static) LAVENDERBLUSH :Color
- 
    
      CSS3 colorlavenderblush
- 
    
    (static) LAWNGREEN :Color
- 
    
      CSS3 colorlawngreen
- 
    
    (static) LEMONCHIFFON :Color
- 
    
      CSS3 colorlemonchiffon
- 
    
    (static) LIGHTBLUE :Color
- 
    
      CSS3 colorlightblue
- 
    
    (static) LIGHTCORAL :Color
- 
    
      CSS3 colorlightcoral
- 
    
    (static) LIGHTCYAN :Color
- 
    
      CSS3 colorlightcyan
- 
    
    (static) LIGHTGOLDENRODYELLOW :Color
- 
    
      CSS3 colorlightgoldenrodyellow
- 
    
    (static) LIGHTGRAY :Color
- 
    
      CSS3 colorlightgray
- 
    
    (static) LIGHTGREEN :Color
- 
    
      CSS3 colorlightgreen
- 
    
    (static) LIGHTGREY :Color
- 
    
      CSS3 colorlightgrey
- 
    
    (static) LIGHTPINK :Color
- 
    
      CSS3 colorlightpink
- 
    
    (static) LIGHTSALMON :Color
- 
    
      CSS3 colorlightsalmon
- 
    
    (static) LIGHTSEAGREEN :Color
- 
    
      CSS3 colorlightseagreen
- 
    
    (static) LIGHTSKYBLUE :Color
- 
    
      CSS3 colorlightskyblue
- 
    
    (static) LIGHTSLATEGRAY :Color
- 
    
      CSS3 colorlightslategray
- 
    
    (static) LIGHTSLATEGREY :Color
- 
    
      CSS3 colorlightslategrey
- 
    
    (static) LIGHTSTEELBLUE :Color
- 
    
      CSS3 colorlightsteelblue
- 
    
    (static) LIGHTYELLOW :Color
- 
    
      CSS3 colorlightyellow
- 
    
    (static) LIME :Color
- 
    
      CSS3 colorlime
- 
    
    (static) LIMEGREEN :Color
- 
    
      CSS3 colorlimegreen
- 
    
    (static) LINEN :Color
- 
    
      CSS3 colorlinen
- 
    
    (static) MAGENTA :Color
- 
    
      CSS3 colormagenta
- 
    
    (static) MAROON :Color
- 
    
      CSS3 colormaroon
- 
    
    (static) MEDIUMAQUAMARINE :Color
- 
    
      CSS3 colormediumaquamarine
- 
    
    (static) MEDIUMBLUE :Color
- 
    
      CSS3 colormediumblue
- 
    
    (static) MEDIUMORCHID :Color
- 
    
      CSS3 colormediumorchid
- 
    
    (static) MEDIUMPURPLE :Color
- 
    
      CSS3 colormediumpurple
- 
    
    (static) MEDIUMSEAGREEN :Color
- 
    
      CSS3 colormediumseagreen
- 
    
    (static) MEDIUMSLATEBLUE :Color
- 
    
      CSS3 colormediumslateblue
- 
    
    (static) MEDIUMSPRINGGREEN :Color
- 
    
      CSS3 colormediumspringgreen
- 
    
    (static) MEDIUMTURQUOISE :Color
- 
    
      CSS3 colormediumturquoise
- 
    
    (static) MEDIUMVIOLETRED :Color
- 
    
      CSS3 colormediumvioletred
- 
    
    (static) MIDNIGHTBLUE :Color
- 
    
      CSS3 colormidnightblue
- 
    
    (static) MINTCREAM :Color
- 
    
      CSS3 colormintcream
- 
    
    (static) MISTYROSE :Color
- 
    
      CSS3 colormistyrose
- 
    
    (static) MOCCASIN :Color
- 
    
      CSS3 colormoccasin
- 
    
    (static) NAVAJOWHITE :Color
- 
    
      CSS3 colornavajowhite
- 
    
    (static) NAVY :Color
- 
    
      CSS3 colornavy
- 
    
    (static) OLDLACE :Color
- 
    
      CSS3 coloroldlace
- 
    
    (static) OLIVE :Color
- 
    
      CSS3 colorolive
- 
    
    (static) OLIVEDRAB :Color
- 
    
      CSS3 colorolivedrab
- 
    
    (static) ORANGE :Color
- 
    
      CSS3 colororange
- 
    
    (static) ORANGERED :Color
- 
    
      CSS3 colororangered
- 
    
    (static) ORCHID :Color
- 
    
      CSS3 colororchid
- 
    
    (static) PALEGOLDENROD :Color
- 
    
      CSS3 colorpalegoldenrod
- 
    
    (static) PALEGREEN :Color
- 
    
      CSS3 colorpalegreen
- 
    
    (static) PALETURQUOISE :Color
- 
    
      CSS3 colorpaleturquoise
- 
    
    (static) PALEVIOLETRED :Color
- 
    
      CSS3 colorpalevioletred
- 
    
    (static) PAPAYAWHIP :Color
- 
    
      CSS3 colorpapayawhip
- 
    
    (static) PEACHPUFF :Color
- 
    
      CSS3 colorpeachpuff
- 
    
    (static) PERU :Color
- 
    
      CSS3 colorperu
- 
    
    (static) PINK :Color
- 
    
      CSS3 colorpink
- 
    
    (static) PLUM :Color
- 
    
      CSS3 colorplum
- 
    
    (static) POWDERBLUE :Color
- 
    
      CSS3 colorpowderblue
- 
    
    (static) PURPLE :Color
- 
    
      CSS3 colorpurple
- 
    
    (static) REBECCAPURPLE :Color
- 
    
      CSS3 colorrebeccapurple
- 
    
    (static) RED :Color
- 
    
      CSS3 colorred
- 
    
    (static) ROSYBROWN :Color
- 
    
      CSS3 colorrosybrown
- 
    
    (static) ROYALBLUE :Color
- 
    
      CSS3 colorroyalblue
- 
    
    (static) SADDLEBROWN :Color
- 
    
      CSS3 colorsaddlebrown
- 
    
    (static) SALMON :Color
- 
    
      CSS3 colorsalmon
- 
    
    (static) SANDYBROWN :Color
- 
    
      CSS3 colorsandybrown
- 
    
    (static) SEAGREEN :Color
- 
    
      CSS3 colorseagreen
- 
    
    (static) SEASHELL :Color
- 
    
      CSS3 colorseashell
- 
    
    (static) SIENNA :Color
- 
    
      CSS3 colorsienna
- 
    
    (static) SILVER :Color
- 
    
      CSS3 colorsilver
- 
    
    (static) SKYBLUE :Color
- 
    
      CSS3 colorskyblue
- 
    
    (static) SLATEBLUE :Color
- 
    
      CSS3 colorslateblue
- 
    
    (static) SLATEGRAY :Color
- 
    
      CSS3 colorslategray
- 
    
    (static) SLATEGREY :Color
- 
    
      CSS3 colorslategrey
- 
    
    (static) SNOW :Color
- 
    
      CSS3 colorsnow
- 
    
    (static) SPRINGGREEN :Color
- 
    
      CSS3 colorspringgreen
- 
    
    (static) STEELBLUE :Color
- 
    
      CSS3 colorsteelblue
- 
    
    (static) TAN :Color
- 
    
      CSS3 colortan
- 
    
    (static) TEAL :Color
- 
    
      CSS3 colorteal
- 
    
    (static) THISTLE :Color
- 
    
      CSS3 colorthistle
- 
    
    (static) TOMATO :Color
- 
    
      CSS3 colortomato
- 
    
    (static) TRANSPARENT :Color
- 
    
      CSS3 colortransparent
- 
    
    (static) TURQUOISE :Color
- 
    
      CSS3 colorturquoise
- 
    
    (static) VIOLET :Color
- 
    
      CSS3 colorviolet
- 
    
    (static) WHEAT :Color
- 
    
      CSS3 colorwheat
- 
    
    (static) WHITE :Color
- 
    
      CSS3 colorwhite
- 
    
    (static) WHITESMOKE :Color
- 
    
      CSS3 colorwhitesmoke
- 
    
    (static) YELLOW :Color
- 
    
      CSS3 coloryellow
- 
    
    (static) YELLOWGREEN :Color
- 
    
      CSS3 coloryellowgreen
Methods
- 
        
    
    
      getAlpha : {number}
- 
    
    
    Returns the alpha channel of the color.- Deprecated:
-  
Since Description 12.0.0Use the getRGBA,getHSLA,getHSVA method instead for fetching color value in different format. 
 Returns:The alpha channel value contained in [0,1]. - Type
- number
 
- 
        
    
    
      getBlue(doNotRound) : {number}
- 
    
    
    Returns the blue channel value of the color.Parameters:Name Type Argument Description doNotRoundboolean <optional> 
 Omit or set to false to return an integer value. Set to true to return the possible fractional value. (Fractional values for the red, green, or blue channels can arise when a color is defined using the "hsl" format.) - Deprecated:
-  
Since Description 12.0.0Use the getRGBA,getHSLA,getHSVA method instead for fetching color value in different format. 
 Returns:The blue channel value contained in [0,255]. - Type
- number
 
- 
        
    
    
      getGreen(doNotRound) : {number}
- 
    
    
    Returns the green channel value of the color.Parameters:Name Type Argument Description doNotRoundboolean <optional> 
 Omit or set to false to return an integer value. Set to true to return the possible fractional value. (Fractional values for the red, green, or blue channels can arise when a color is defined using the "hsl" format.) - Deprecated:
-  
Since Description 12.0.0Use the getRGBA,getHSLA,getHSVA method instead for fetching color value in different format. 
 Returns:The green channel value contained in [0,255]. - Type
- number
 
- 
        
    
    
      getHSLA : {Color.HSLA}
- 
    
    
    Returns the red channel value of the color arise when a color is defined using the "hsl" format.)Returns:The HSLA value in the range [0,255]. - Type
- Color.HSLA
 
- 
        
    
    
      getHSVA : {Color.HSVA}
- 
    
    
    Returns the red channel value of the color arise when a color is defined using the "hsl" format.)Returns:The HSLA value in the range [0,255]. - Type
- Color.HSVA
 
- 
        
    
    
      getRed(doNotRound) : {number}
- 
    
    
    } /** Returns the red channel value of the color.Parameters:Name Type Argument Description doNotRoundboolean <optional> 
 Omit or set to false to return an integer value. Set to true to return the possible fractional value. (Fractional values for the red, green, or blue channels can arise when a color is defined using the "hsl" format.) - Deprecated:
-  
Since Description 12.0.0Use the getRGBA,getHSLA,getHSVA method instead for fetching color value in different format. 
 Returns:The red channel value in the range [0,255]. - Type
- number
 
- 
        
    
    
      getRGBA : {Color.RGBA}
- 
    
    
    Returns the red channel value of the color arise when a color is defined using the "hsl" format.)Returns:The RGBA value in the range [0,255]. - Type
- Color.RGBA
 
- 
        
    
    
      isEqual(color) : {boolean}
- 
    
    
    Compares this color object with the supplied color specification, and returns true if they represent the same color, else false.Parameters:Name Type Description colorColor The color to be compared. Returns:Returns true if the comperand represents the same color. - Type
- boolean
 
- 
        
    
    
      toString : {string}
- 
    
    
    Returns the color as an "rgb" or rgba" (if the alpha value is less than 1) CSS3 color specification string.Returns:The color as an "rgb" or "rgba" CSS3 color specification string. - Type
- string
 
Type Definitions
- 
    
    HSLA
- 
    
    
    
     
  Properties:Name Type Argument Description anumber <optional> 
 the optional alpha value hnumber the hue value lnumber the luminosity or lightness value snumber the saturation value 
- 
    
    HSVA
- 
    
    
    
     
  Properties:Name Type Argument Description anumber <optional> 
 the optional alpha value hnumber the hue value snumber the saturation value vnumber the value 
- 
    
    RGBA
- 
    
    
    
     
  Properties:Name Type Argument Description anumber <optional> 
 the optional alpha value bnumber the blue value gnumber the green value rnumber the red value