Fixed colours

This commit is contained in:
hydrabolt
2015-10-28 12:13:09 +00:00
parent 2eed36d297
commit c3b6dba6be
12 changed files with 194 additions and 81 deletions

View File

@@ -2,49 +2,61 @@
credits to izy521 for the colour list
https://github.com/izy521/discord.io/blob/master/docs/colors.md
*/
module.exports = {
DEFAULT: 0,
AQUA: 1752220,
GREEN: 3066993,
BLUE: 3447003,
PURPLE: 10181046,
GOLD: 15844367,
ORANGE: 15105570,
RED: 15158332,
GREY: 9807270,
DARKER_GREY: 8359053,
NAVY: 3426654,
DARK_AQUA: 1146986,
DARK_GREEN: 2067276,
DARK_BLUE: 2123412,
DARK_PURPLE: 7419530,
DARK_GOLD: 12745742,
DARK_ORANGE: 11027200,
DARK_RED: 10038562,
DARK_GREY: 9936031,
LIGHT_GREY: 12370112,
DARK_NAVY: 2899536
}
exports.DEFAULT = 0;
exports.AQUA = 1752220;
exports.GREEN= 3066993;
exports.BLUE= 3447003;
exports.PURPLE= 10181046;
exports.GOLD= 15844367;
exports.ORANGE= 15105570;
exports.RED= 15158332;
exports.GREY= 9807270;
exports.DARKER_GREY= 8359053;
exports.NAVY= 3426654;
exports.DARK_AQUA= 1146986;
exports.DARK_GREEN= 2067276;
exports.DARK_BLUE= 2123412;
exports.DARK_PURPLE= 7419530;
exports.DARK_GOLD= 12745742;
exports.DARK_ORANGE= 11027200;
exports.DARK_RED= 10038562;
exports.DARK_GREY= 9936031;
exports.LIGHT_GREY= 12370112;
exports.DARK_NAVY= 2899536;
exports.toDec = function (data) {
var hextest = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i;
exports.toDec = function(data){
var hextest = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/;
var num;
if(hextest.test(data)){
if (hextest.test(data)) {
// it's a hex number with a # in front
num = data.substr(1).toString(10);
}else if(hextest.test("#" + data)){
// there's a bug in discord as of 28/10/15, where any
// hex colors beginning with a 0 do not render properly.
// this is a temporary fix, and it does mean that you won't
// get correct colors all the time, although it is barely noticeable.
if(data.charAt(1) === "0"){
var tdata = data.split("");
tdata[1] = 1;
data = tdata.join("");
}
num = parseInt(data.substr(1), 16).toString(10);
} else if (hextest.test("#" + data)) {
// it's a hex number with no # in front
num = data.toString(10);
}else{
num = parseInt(data, 16).toString(10);
} else {
num = data.toString(10);
}
return num;
console.log(num);
return parseInt(num);
}
exports.toHex = function(data){
exports.toHex = function (data) {
return "#" + data.toString(16);
}