Fixed Colours again

This commit is contained in:
hydrabolt
2015-10-28 15:09:55 +00:00
parent 674ea664ed
commit 1125d4ae97
4 changed files with 2135 additions and 59 deletions

View File

@@ -28,6 +28,9 @@ exports.toDec = function (data) {
var hextest = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i;
var num;
if(!data)
return 0;
if (hextest.test(data)) {
// it's a hex number with a # in front
@@ -45,13 +48,16 @@ exports.toDec = function (data) {
num = parseInt(data.substr(1), 16).toString(10);
} else if (hextest.test("#" + data)) {
// it's a hex number with no # in front
num = parseInt(data, 16).toString(10);
if(data.charAt(0) === "0"){
var tdata = data.split("");
tdata[0] = 1;
data = tdata.join("");
}
num = parseInt(data, 16);
} else {
num = data.toString(10);
}
console.log(num);
return parseInt(num);
}