Packageardisia.utils
Classpublic class ColorUtils
InheritanceColorUtils Inheritance Object

Useful color functions. Purely static class.



Protected Properties
 PropertyDefined By
  defaultChartColors : Array
[static] Default chart colors.
ColorUtils
Public Methods
 MethodDefined By
  
convertHexToUint(hex:String):uint
[static] Converts a hex string into an unsigned integer and returns the value.
ColorUtils
  
convertRGBtoUint(r:Number, g:Number, b:Number):uint
[static] Converts a red/green/blue channel into a uint.
ColorUtils
  
convertUintToRGB(color:uint):Array
[static] Return the red, green, and blue components of a color passed in uint hex format.
ColorUtils
  
getColorBetweenColors(colorA:uint, colorB:uint, ratio:Number):uint
[static] Return the uint color located at the provided ratio between the passed colors.
ColorUtils
  
getDefaultChartColor(index:int):uint
[static] Return the default color for a series in a chart with no colorizer defined.
ColorUtils
  
getGreyScaleArray(numColors:int = 210):Array
[static] Return an array of gray scale colors.
ColorUtils
  
[static] Return a typical array of web safe colors.
ColorUtils
  
uintToHex(num:uint):String
[static] Converts a color defined in uint to a hex value.
ColorUtils
Property Detail
defaultChartColorsproperty
protected static var defaultChartColors:Array

Default chart colors.

Method Detail
convertHexToUint()method
public static function convertHexToUint(hex:String):uint

Converts a hex string into an unsigned integer and returns the value.

Parameters

hex:String — the hex string to convert to an unsigned integer

Returns
uint — uint the converted value
convertRGBtoUint()method 
public static function convertRGBtoUint(r:Number, g:Number, b:Number):uint

Converts a red/green/blue channel into a uint.

Parameters

r:Number — the Number representing the red channel
 
g:Number — the Number representing the green channel
 
b:Number — the Number representing the blue channel

Returns
uint — a uint of the rgb color
convertUintToRGB()method 
public static function convertUintToRGB(color:uint):Array

Return the red, green, and blue components of a color passed in uint hex format.

Parameters

color:uint — color defined as a uint

Returns
Array — array of [red, green, blue]
getColorBetweenColors()method 
public static function getColorBetweenColors(colorA:uint, colorB:uint, ratio:Number):uint

Return the uint color located at the provided ratio between the passed colors. Useful for creating gradients and is utilized heavily by the Colorizer class.

Parameters

colorA:uint — the uint color at one end of the gradient
 
colorB:uint — the uint color at the opposite end of the gradient
 
ratio:Number — the ratio between colorA and colorB to return the calculated color

Returns
uint — the uint color value
getDefaultChartColor()method 
public static function getDefaultChartColor(index:int):uint

Return the default color for a series in a chart with no colorizer defined.

Maximum of 28 colors.

Parameters

index:int — int

Returns
uint
getGreyScaleArray()method 
public static function getGreyScaleArray(numColors:int = 210):Array

Return an array of gray scale colors.

Parameters

numColors:int (default = 210) — the number of greys to create and return

Returns
Array — an Array of uint color values
getWebSafeArray()method 
public static function getWebSafeArray():Array

Return a typical array of web safe colors.

Returns
Array — an Array of uint color values
uintToHex()method 
public static function uintToHex(num:uint):String

Converts a color defined in uint to a hex value.

Note, there is no guarantee that the return string will be 6 characters long.

Parameters

num:uint — the uint to convert

Returns
String — a String representation of the uint