Skip to content

Commit

Permalink
the colorpicker can now interpret short hexcodes (#fff)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrflix committed May 16, 2011
1 parent 17b3028 commit 314d421
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/colorpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,12 @@ var colorpicker = {
var missingLength = 6 - hex.length;
if(missingLength === 3){
var parts = hex.split("");
if(parts[0]===parts[1] && parts[1]===parts[2]){
hex = parts[0]+parts[0]+parts[0]+parts[0]+parts[0]+parts[0];
missingLength = 0;
hex = parts[0]+parts[0]+parts[1]+parts[1]+parts[2]+parts[2];
} else {
for(var i = 0; i<missingLength; i++){
hex = "0" + hex;
}
}
for(var i = 0; i<missingLength; i++){ hex = "0" + hex; };
this.hex = hex;
},
setHsb: function() {
Expand Down

0 comments on commit 314d421

Please sign in to comment.