diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-08-05 16:03:00 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-08-05 16:03:00 -0400 |
commit | 180ac80d4e7b5fd5ab16abd74f9c5aa330d59ebf (patch) | |
tree | 1e5f9d95176fcf191e48ecae5e254544d7cf8384 /js/userdesign.go.js | |
parent | e797001be4cd982ed778bda16744ab4007eb31c8 (diff) | |
parent | c3a522623c3a0628c33407ee01b16e189c44bba5 (diff) |
Merge branch '0.8.x' of git@gitorious.org:laconica/mainline into 0.8.x
Diffstat (limited to 'js/userdesign.go.js')
-rw-r--r-- | js/userdesign.go.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/js/userdesign.go.js b/js/userdesign.go.js index 70dd9c7de..c53569bea 100644 --- a/js/userdesign.go.js +++ b/js/userdesign.go.js @@ -27,13 +27,14 @@ $(document).ready(function() { } } + /* rgb2hex written by R0bb13 <robertorebollo@gmail.com> */ function rgb2hex(rgb) { rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); - 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[1]) + hex(rgb[2]) + hex(rgb[3]); + return '#' + dec2hex(rgb[1]) + dec2hex(rgb[2]) + dec2hex(rgb[3]); + } + 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]; } function UpdateColors(S) { |