Skip to content

Commit

Permalink
Fix: Changed handling of short hex colours.
Browse files Browse the repository at this point in the history
  • Loading branch information
robinmalburn committed Jan 13, 2013
1 parent 5386e07 commit 81eea43
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion jquery.tagcloud.js
Expand Up @@ -18,7 +18,7 @@
// Converts hex to an RGB array
var toRGB = function(code) {
if (code.length === 4) {
code = jQuery.map(/\w+/.exec(code), function(el) {return el + el; }).join("");
code = code.replace(/(\w)(\w)(\w)/gi, "\$1\$1\$2\$2\$3\$3");
}
var hex = /(\w{2})(\w{2})(\w{2})/.exec(code);
return [parseInt(hex[1], 16), parseInt(hex[2], 16), parseInt(hex[3], 16)];
Expand Down

0 comments on commit 81eea43

Please sign in to comment.