Packagestarling.utils
Classpublic class Color
InheritanceColor Inheritance Object

A utility class containing predefined colors and methods converting between different color representations.



Public Methods
 MethodDefined By
  
argb(alpha:int, red:int, green:int, blue:int):uint
[static] Creates an ARGB color, stored in an unsigned integer.
Color
  
getAlpha(color:uint):int
[static] Returns the alpha part of an ARGB color (0 - 255).
Color
  
getBlue(color:uint):int
[static] Returns the blue part of an (A)RGB color (0 - 255).
Color
  
getGreen(color:uint):int
[static] Returns the green part of an (A)RGB color (0 - 255).
Color
  
getRed(color:uint):int
[static] Returns the red part of an (A)RGB color (0 - 255).
Color
  
interpolate(startColor:uint, endColor:uint, ratio:Number):uint
[static] Calculates a smooth transition between one color to the next.
Color
  
multiply(color:uint, factor:Number):uint
[static] Multiplies all channels of an (A)RGB color with a certain factor.
Color
  
rgb(red:int, green:int, blue:int):uint
[static] Creates an RGB color, stored in an unsigned integer.
Color
  
setAlpha(color:uint, alpha:int):uint
[static] Sets the alpha part of an ARGB color (0 - 255).
Color
  
setBlue(color:uint, blue:int):uint
[static] Sets the blue part of an (A)RGB color (0 - 255).
Color
  
setGreen(color:uint, green:int):uint
[static] Sets the green part of an (A)RGB color (0 - 255).
Color
  
setRed(color:uint, red:int):uint
[static] Sets the red part of an (A)RGB color (0 - 255).
Color
  
toVector(color:uint, out:Vector.<Number> = null):Vector.<Number>
[static] Converts a color to a vector containing the RGBA components (in this order) scaled between 0 and 1.
Color
Public Constants
 ConstantDefined By
  AQUA : uint = 0x00ffff
[static]
Color
  BLACK : uint = 0x000000
[static]
Color
  BLUE : uint = 0x0000ff
[static]
Color
  FUCHSIA : uint = 0xff00ff
[static]
Color
  GRAY : uint = 0x808080
[static]
Color
  GREEN : uint = 0x008000
[static]
Color
  LIME : uint = 0x00ff00
[static]
Color
  MAROON : uint = 0x800000
[static]
Color
  NAVY : uint = 0x000080
[static]
Color
  OLIVE : uint = 0x808000
[static]
Color
  PURPLE : uint = 0x800080
[static]
Color
  RED : uint = 0xff0000
[static]
Color
  SILVER : uint = 0xc0c0c0
[static]
Color
  TEAL : uint = 0x008080
[static]
Color
  WHITE : uint = 0xffffff
[static]
Color
  YELLOW : uint = 0xffff00
[static]
Color
Method Detail
argb()method
public static function argb(alpha:int, red:int, green:int, blue:int):uint

Creates an ARGB color, stored in an unsigned integer. Channels are expected in the range 0 - 255.

Parameters

alpha:int
 
red:int
 
green:int
 
blue:int

Returns
uint
getAlpha()method 
public static function getAlpha(color:uint):int

Returns the alpha part of an ARGB color (0 - 255).

Parameters

color:uint

Returns
int
getBlue()method 
public static function getBlue(color:uint):int

Returns the blue part of an (A)RGB color (0 - 255).

Parameters

color:uint

Returns
int
getGreen()method 
public static function getGreen(color:uint):int

Returns the green part of an (A)RGB color (0 - 255).

Parameters

color:uint

Returns
int
getRed()method 
public static function getRed(color:uint):int

Returns the red part of an (A)RGB color (0 - 255).

Parameters

color:uint

Returns
int
interpolate()method 
public static function interpolate(startColor:uint, endColor:uint, ratio:Number):uint

Calculates a smooth transition between one color to the next. ratio is expected between 0 and 1.

Parameters

startColor:uint
 
endColor:uint
 
ratio:Number

Returns
uint
multiply()method 
public static function multiply(color:uint, factor:Number):uint

Multiplies all channels of an (A)RGB color with a certain factor.

Parameters

color:uint
 
factor:Number

Returns
uint
rgb()method 
public static function rgb(red:int, green:int, blue:int):uint

Creates an RGB color, stored in an unsigned integer. Channels are expected in the range 0 - 255.

Parameters

red:int
 
green:int
 
blue:int

Returns
uint
setAlpha()method 
public static function setAlpha(color:uint, alpha:int):uint

Sets the alpha part of an ARGB color (0 - 255).

Parameters

color:uint
 
alpha:int

Returns
uint
setBlue()method 
public static function setBlue(color:uint, blue:int):uint

Sets the blue part of an (A)RGB color (0 - 255).

Parameters

color:uint
 
blue:int

Returns
uint
setGreen()method 
public static function setGreen(color:uint, green:int):uint

Sets the green part of an (A)RGB color (0 - 255).

Parameters

color:uint
 
green:int

Returns
uint
setRed()method 
public static function setRed(color:uint, red:int):uint

Sets the red part of an (A)RGB color (0 - 255).

Parameters

color:uint
 
red:int

Returns
uint
toVector()method 
public static function toVector(color:uint, out:Vector.<Number> = null):Vector.<Number>

Converts a color to a vector containing the RGBA components (in this order) scaled between 0 and 1.

Parameters

color:uint
 
out:Vector.<Number> (default = null)

Returns
Vector.<Number>
Constant Detail
AQUAConstant
public static const AQUA:uint = 0x00ffff

BLACKConstant 
public static const BLACK:uint = 0x000000

BLUEConstant 
public static const BLUE:uint = 0x0000ff

FUCHSIAConstant 
public static const FUCHSIA:uint = 0xff00ff

GRAYConstant 
public static const GRAY:uint = 0x808080

GREENConstant 
public static const GREEN:uint = 0x008000

LIMEConstant 
public static const LIME:uint = 0x00ff00

MAROONConstant 
public static const MAROON:uint = 0x800000

NAVYConstant 
public static const NAVY:uint = 0x000080

OLIVEConstant 
public static const OLIVE:uint = 0x808000

PURPLEConstant 
public static const PURPLE:uint = 0x800080

REDConstant 
public static const RED:uint = 0xff0000

SILVERConstant 
public static const SILVER:uint = 0xc0c0c0

TEALConstant 
public static const TEAL:uint = 0x008080

WHITEConstant 
public static const WHITE:uint = 0xffffff

YELLOWConstant 
public static const YELLOW:uint = 0xffff00