Class com.sekati.utils.ColorUtils

Description

Static class wrapping various Color utilities.

Method Index

argb2hex(), changeContrast(), getColor(), hex2argb(), hex2rgb(), randHex(), rgb2hex(), rgb2hexString(), rgbObj2hex(), setColor()

Method Detail

hex2rgb

static public function hex2rgb(hex:Number):Object

Convert hexadecimal Number to rgb Object

Return

Object - {r,g,b}

hex2argb

static public function hex2argb(val:Number):Object

Convert argb Object to hexidecimal Number

Return

Object - {a,r,g,b}

argb2hex

static public function argb2hex(a:Number, r:Number, g:Number, b:Number):Number

Convert argb to hexadecimal.

 Usage:
 	hex=argbtohex(255,0,255,0) //outputs a 32-bit red hexadecimal value as a base-10 number
 	

rgb2hex

static public function rgb2hex(r:Number, g:Number, b:Number):Number

Convert rgb to hexadecimal.

Return

Number

rgbObj2hex

static public function rgbObj2hex(o:Object):Number

Convert rgb Object to hexadecimal

Parameters

o(Object) a color object {r,g,b}

Return

Number

rgb2hexString

static public function rgb2hexString(r:Number, g:Number, b:Number, hasPrefix:Boolean):String

Convert rgb to hexadecimal String

Parameters

r(Number)
g(Number)
b(Number)
hasPrefix(Boolean) add optional "0x" prefix to return

Return

String

randHex

static public function randHex():String

get a random hexidecimal color

Return

String

setColor

static public function setColor(obj:Object, hex:Number):Void

set color of a movieclip or textfield

Parameters

obj(Object)
hex(Number)

Return

Void

getColor

static public function getColor(obj:Object):Number

get color from a movieclip or textfield

Parameters

obj(Object)

Return

Number

changeContrast

static public function changeContrast(hex:Number, inc:Number):Number

Change the contrast of a hexidecimal Number by a certain increment

Parameters

hex(Number) color value to shift contrast on
inc(Number) increment value to shift

Return

Number - new hex color value