atom feed3 messages in com.googlegroups.jquery-enRe: Farbtastic RGB to Hex and vice versa
FromSent OnAttachments
ethodaddyApr 1, 2008 7:44 am 
ethodaddyApr 4, 2008 7:42 am 
R0bb13Apr 14, 2008 3:11 am 
Subject:Re: Farbtastic RGB to Hex and vice versa
From:R0bb13 (robe@gmail.com)
Date:Apr 14, 2008 3:11:08 am
List:com.googlegroups.jquery-en

Hi,

I had the same problem and I solve it writing my own function to convert rgb values to hex:

//Function to get hex format a rgb colour function rgb2hex(rgb) { //generates the hex-digits for a colour. function hex(x) { hexDigits = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"); return isNaN(x) ? "00" : hexDigits[(x - x % 16) / 16] + hexDigits[x % 16]; }

return "#" + hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]); }

I think this is much better than the functions you are using. Nobody seems to pay attention to this plugin :(