Packagecom.degrafa.core.utils
Classpublic class ColorUtil

A helper utility class for color conversion.



Public Methods
 MethodDefined by
  
decColorToHex(color:Number):String
[static] Converts a decimal color to a hex value.
ColorUtil
  
hexToRgb(hex:Number):Object
[static] Converts a HEX color value to an RGB value object.
ColorUtil
  
parseColorNotation(color:uint):uint
[static] Take a short color notation and convert it to a full color.
ColorUtil
  
resolveColor(value:Object, none:uint = 0):uint
[static]
ColorUtil
  
resolveColorFromCMYK(value:String):uint
[static] Allows an comma-separated list of 4 numerical values that represent cmyk and are then converted to a decimal color value.
ColorUtil
  
resolveColorFromKey(value:String, none:uint = 0):uint
[static] Converts Color Keys to color values.
ColorUtil
  
resolveColorFromRGB(value:String):Number
[static] Converts an RGB numeric comma separated list to a decimal color value.
ColorUtil
  
resolveColorFromRGBPercent(value:String):uint
[static] Allows an comma-separated list of three numerical or percent values that are then converted to a hex value.
ColorUtil
Method detail
decColorToHex()method
public static function decColorToHex(color:Number):String

Converts a decimal color to a hex value.

Parameters
color:Number

Returns
String
hexToRgb()method 
public static function hexToRgb(hex:Number):Object

Converts a HEX color value to an RGB value object.

Parameters
hex:Number

Returns
Object
parseColorNotation()method 
public static function parseColorNotation(color:uint):uint

Take a short color notation and convert it to a full color. Repeats each value once so that #FB0 expands to #FFBB00

Parameters
color:uint

Returns
uint
resolveColor()method 
public static function resolveColor(value:Object, none:uint = 0):uintParameters
value:Object
 
none:uint (default = 0)

Returns
uint
resolveColorFromCMYK()method 
public static function resolveColorFromCMYK(value:String):uint

Allows an comma-separated list of 4 numerical values that represent cmyk and are then converted to a decimal color value.

Parameters
value:String

Returns
uint
resolveColorFromKey()method 
public static function resolveColorFromKey(value:String, none:uint = 0):uint

Converts Color Keys to color values. If the specified color key is not supported then black is used.

Parameters
value:String
 
none:uint (default = 0)

Returns
uint
resolveColorFromRGB()method 
public static function resolveColorFromRGB(value:String):Number

Converts an RGB numeric comma separated list to a decimal color value. Expected order R,G,B.

Parameters
value:String

Returns
Number
resolveColorFromRGBPercent()method 
public static function resolveColorFromRGBPercent(value:String):uint

Allows an comma-separated list of three numerical or percent values that are then converted to a hex value.

Parameters
value:String

Returns
uint