//ColorUtil to convert colors (rgb to hex, hex to rgb, hex to css)
package id.web.Pustakaflash.Display
{
/**
* @author Ricko nada
*/
public class ColorUtil
{
public static function rgb2hex(r : uint, g : uint, b : uint, a : uint = 255) : uint
{
return (a << 24) | (r << 16) | (g << 8) | b;
}
public static function hex2rgb(color : uint) : Object
{
var c : Object = {};
c.r = color >> 16 & 0xFF;
c.g = color >> 8 & 0xFF;
c.b = color & 0xFF;
return c;
}
public static function hex2css( color : int ) : String
{
return "#" + color.toString(16);
}
}
}