summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@controlyourself.ca>2009-08-25 22:47:54 +0000
committerSarven Capadisli <csarven@controlyourself.ca>2009-08-25 22:47:54 +0000
commit70ef9d89fab6daaf0cf2169007475e92859d05c4 (patch)
tree51a05b6a152258e4457cda049fcae7103382df45 /js
parent6c3149334cf69a33026a75be9f5ea579b2de3b8d (diff)
Updated rgb2hex() to handle IE. It turns out that jQuery is giving hex
to IE and RGB to Firefox, Opera, Safari. Fun.
Diffstat (limited to 'js')
-rw-r--r--js/userdesign.go.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/js/userdesign.go.js b/js/userdesign.go.js
index c53569bea..8ddb9ec38 100644
--- a/js/userdesign.go.js
+++ b/js/userdesign.go.js
@@ -27,11 +27,12 @@ $(document).ready(function() {
}
}
- /* rgb2hex written by R0bb13 <robertorebollo@gmail.com> */
function rgb2hex(rgb) {
+ if (rgb.slice(0,1) == '#') { return rgb; }
rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
return '#' + dec2hex(rgb[1]) + dec2hex(rgb[2]) + dec2hex(rgb[3]);
}
+ /* dec2hex written by R0bb13 <robertorebollo@gmail.com> */
function dec2hex(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];