Added in methods to generate the hex code when a user clicks on one of the outputted boxes
This commit is contained in:
parent
cdc4218e3a
commit
e19f1c475c
2 changed files with 18 additions and 1 deletions
14
js/franz.js
14
js/franz.js
|
|
@ -232,6 +232,18 @@ var franz = {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
RGBtoHex: function(rgb) {
|
||||
var hex = [];
|
||||
|
||||
if(rgb[3] == 0) return 'transparent';
|
||||
|
||||
for(var i = 0; i < 3; i++) {
|
||||
var bit = (rgb[i] - 0).toString(16);
|
||||
hex.push(bit.length == 1 ? ('0' + bit) : bit);
|
||||
}
|
||||
|
||||
return '#' + hex.join('');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue