HTML needs the RGB (Red, Green, Blue) values of color converted to Hex. Hex is basically just a compact way for a computer to store 16 different values in 1 character. When you use color on Web pages, you often have to take a color code that was generated in one program and convert it into the corresponding Hex value for a Web page. The small javascript function below demonstrates how to convert RGB values to hex string.
function RGB2HTML(red, green, blue)
{
var decColor = red + 256 * green + 65536 * blue;
return decColor.toString(16);
}
Sunday, May 13, 2007
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment