/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var magentaRed:int = 255; var magentaGreen:int = 0; var magentaBlue:int = 255; var magentaCSS:String = RGBToCSS(magentaRed, magentaGreen, magentaBlue); trace("magentaCSS: " + magentaCSS); function RGBToCSS(r:int, g:int, b:int):String { var hex:uint = r << 16 | g << 8 | b; return "#" + hex.toString(16).toUpperCase(); } // OUTPUT // magentaCSS: #FF00FF