Sencha Documentation

Represents an RGB color and provides helper functions get color components in HSL color space.

Config Options

 
The default factor to compute the lighter or darker color. Defaults to 0.2.
The default factor to compute the lighter or darker color. Defaults to 0.2.

Methods

 
constructor( Number red, Number green, Number blue ) : Void

Parameters

  • red : Number
    Red component (0..255)
  • green : Number
    Green component (0..255)
  • blue : Number
    Blue component (0..255)

Returns

  • Void
 
fromHSL( Number h, Number s, Number l ) : Void
Create a new color based on the specified HSL values.
Create a new color based on the specified HSL values.

Parameters

  • h : Number
    Hue component (0..359)
  • s : Number
    Saturation component (0..1)
  • l : Number
    Lightness component (0..1)

Returns

  • Void
 
fromString( String str ) : Void
Parse the string and create a new color. Supported formats: '#rrggbb', '#rgb', and 'rgb(r,g,b)'. If the string is not...
Parse the string and create a new color. Supported formats: '#rrggbb', '#rgb', and 'rgb(r,g,b)'. If the string is not recognized, an undefined will be returned instead.

Parameters

  • str : String
    Color in string.

Returns

  • Void
 
getBlue : Number
Get the blue component of the color, in the range 0..255.
Get the blue component of the color, in the range 0..255.
 
getDarker( Number factor ) : Ext.draw.Color
Return a new color that is darker than this color.
Return a new color that is darker than this color.

Parameters

  • factor : Number
    Darker factor (0..1), default to 0.2

Returns

  • Ext.draw.Color   undefined
 
Returns the gray value (0 to 255) of the color. The gray value is calculated using the formula r*0.3 + g*0.59 + b*0.1...
Returns the gray value (0 to 255) of the color. The gray value is calculated using the formula r*0.3 + g*0.59 + b*0.11.
 
getGreen : Number
Get the green component of the color, in the range 0..255.
Get the green component of the color, in the range 0..255.
 
getHSL : Array
Get the equivalent HSL components of the color.
Get the equivalent HSL components of the color.
 
getLighter( Number factor ) : Ext.draw.Color
Return a new color that is lighter than this color.
Return a new color that is lighter than this color.

Parameters

  • factor : Number
    Lighter factor (0..1), default to 0.2

Returns

  • Ext.draw.Color   undefined
 
getRGB : Array
Get the RGB values.
Get the RGB values.
 
getRed : Number
Get the red component of the color, in the range 0..255.
Get the red component of the color, in the range 0..255.
 
toHex( String|Array color ) : Void
Convert a color to hexadecimal format.
Convert a color to hexadecimal format.

Parameters

  • color : String|Array
    The color value (i.e 'rgb(255, 255, 255)', 'color: #ffffff'). Can also be an Array, in this case the function handles the first member.

Returns

  • Void
 
toString : String
Return the color in the hex format, i.e. '#rrggbb'.
Return the color in the hex format, i.e. '#rrggbb'.