RGB-to-Hex Conversion Question is: How do I convert RGB values of a color to a hexadecimal string?
The algorithm is as follows: make sure that RGB values are in the range 0…255, convert RGB values to hex strings, and then merge the three strings. Here is a script that does this conversion:
function RGBtoHex(R,G,B) { return toHex(R)+toHex(G)+toHex(B); }
function toHex(N)...
by saim at November 3rd, 2009 at 08:11 am