Packagecom.google.maps
Classpublic final class Color

Color stores a color and provides methods for conversion between different textual and numeric representations of color.



Public Properties
 PropertyDefined by
  b : Number
Blue component, in the range [0,255].
Color
  g : Number
Green component, in the range [0,255].
Color
  r : Number
Red component, in the range [0,255].
Color
  rgb : Number
[read-only] Color as a Number, for example 0x804020.
Color
Public Methods
 MethodDefined by
  
Color(clr:Number)
Constructs a Color from a Number.
Color
  
incRGB(deltaR:Number, deltaG:Number, deltaB:Number):void
Increments this color's R, G and B components by individual delta values.
Color
  
setRGB(compR:Number, compG:Number, compB:Number):void
Sets this color from R, G and B components, all in the range [0,255].
Color
  
toHtml(color:Number):String
[static] Returns a color in HTML format, for example '#321fba'.
Color
  
toString():String
Returns a string representation of this color, for example 'R:64/G:32/B:255'.
Color
Public Constants
 ConstantDefined by
  BLACK : Number = 0x000000
[static]
Color
  BLUE : Number = 0x0000ff
[static]
Color
  CYAN : Number = 0x00ffff
[static]
Color
  DEFAULTLINK : Number = 0x7777cc
[static] Color used for the 'Terms of Use' link.
Color
  GRAY1 : Number = 0x101010
[static]
Color
  GRAY10 : Number = 0xa0a0a0
[static]
Color
  GRAY11 : Number = 0xb0b0b0
[static]
Color
  GRAY12 : Number = 0xc0c0c0
[static]
Color
  GRAY13 : Number = 0xd0d0d0
[static]
Color
  GRAY14 : Number = 0xe0e0e0
[static]
Color
  GRAY15 : Number = 0xf0f0f0
[static]
Color
  GRAY2 : Number = 0x202020
[static]
Color
  GRAY3 : Number = 0x303030
[static]
Color
  GRAY4 : Number = 0x404040
[static]
Color
  GRAY5 : Number = 0x505050
[static]
Color
  GRAY6 : Number = 0x606060
[static]
Color
  GRAY7 : Number = 0x707070
[static]
Color
  GRAY8 : Number = 0x808080
[static]
Color
  GRAY9 : Number = 0x909090
[static]
Color
  GREEN : Number = 0x00ff00
[static]
Color
  MAGENTA : Number = 0xff00ff
[static]
Color
  RED : Number = 0xff0000
[static]
Color
  WHITE : Number = 0xffffff
[static]
Color
  YELLOW : Number = 0xffff00
[static]
Color
Property detail
bproperty
b:Number  [read-write]

Blue component, in the range [0,255].

Implementation
    public function get b():Number
    public function set b(value:Number):void
gproperty 
g:Number  [read-write]

Green component, in the range [0,255].

Implementation
    public function get g():Number
    public function set g(value:Number):void
rproperty 
r:Number  [read-write]

Red component, in the range [0,255].

Implementation
    public function get r():Number
    public function set r(value:Number):void
rgbproperty 
rgb:Number  [read-only]

Color as a Number, for example 0x804020.

Implementation
    public function get rgb():Number
Constructor detail
Color()constructor
public function Color(clr:Number)

Constructs a Color from a Number.

Parameters
clr:Number

Example
   var col:Color = new Color(0x0000ff);  // blue

Method detail
incRGB()method
public function incRGB(deltaR:Number, deltaG:Number, deltaB:Number):void

Increments this color's R, G and B components by individual delta values. Each color component is clamped to the valid range [0,255].

Parameters
deltaR:Number — R component delta.
 
deltaG:Number — G component delta.
 
deltaB:Number — B component delta.

Example
   var col:Color = new Color(0xff0000);  // color is red
   col.incRGB(0, 255, 0);  // color is now yellow

setRGB()method 
public function setRGB(compR:Number, compG:Number, compB:Number):void

Sets this color from R, G and B components, all in the range [0,255].

Parameters
compR:Number — New R component.
 
compG:Number — New G component.
 
compB:Number — New B component.

Example
   var col:Color = new Color(0);
   col.setRGB(128, 64, 255);  // lilac

toHtml()method 
public static function toHtml(color:Number):String

Returns a color in HTML format, for example '#321fba'. Clamps the number to the range [0x000000,0xffffff]. Returns the encoding for black if the input value is not a valid number.

Parameters
color:Number — Color to represent in HTML format.

Returns
String — color as a HTML String.

Example
   var col:Color = new Color(0xff8020);
   trace(col.toHtml());  // outputs "#ff8020"

toString()method 
public function toString():String

Returns a string representation of this color, for example 'R:64/G:32/B:255'.

Returns
String — This color as a String.

Example
   var col:Color = new Color(0xff8020);
   trace(col.toString());  // outputs "R:255/G:128/B:32"

Constant detail
BLACKconstant
public static const BLACK:Number = 0x000000
BLUEconstant 
public static const BLUE:Number = 0x0000ff
CYANconstant 
public static const CYAN:Number = 0x00ffff
DEFAULTLINKconstant 
public static const DEFAULTLINK:Number = 0x7777cc

Color used for the 'Terms of Use' link.

GRAY1constant 
public static const GRAY1:Number = 0x101010
GRAY10constant 
public static const GRAY10:Number = 0xa0a0a0
GRAY11constant 
public static const GRAY11:Number = 0xb0b0b0
GRAY12constant 
public static const GRAY12:Number = 0xc0c0c0
GRAY13constant 
public static const GRAY13:Number = 0xd0d0d0
GRAY14constant 
public static const GRAY14:Number = 0xe0e0e0
GRAY15constant 
public static const GRAY15:Number = 0xf0f0f0
GRAY2constant 
public static const GRAY2:Number = 0x202020
GRAY3constant 
public static const GRAY3:Number = 0x303030
GRAY4constant 
public static const GRAY4:Number = 0x404040
GRAY5constant 
public static const GRAY5:Number = 0x505050
GRAY6constant 
public static const GRAY6:Number = 0x606060
GRAY7constant 
public static const GRAY7:Number = 0x707070
GRAY8constant 
public static const GRAY8:Number = 0x808080
GRAY9constant 
public static const GRAY9:Number = 0x909090
GREENconstant 
public static const GREEN:Number = 0x00ff00
MAGENTAconstant 
public static const MAGENTA:Number = 0xff00ff
REDconstant 
public static const RED:Number = 0xff0000
WHITEconstant 
public static const WHITE:Number = 0xffffff
YELLOWconstant 
public static const YELLOW:Number = 0xffff00