DiscordBot
DiscordBot copied to clipboard
Replace use of colors with chalk package
Replace the use of colors with chalk for colored logging to the terminal. Chalk is more popular and maintained as well as having more control over color. The use of colors package is limited to DiscordBot/src/utils/logging.js
. Since the logging util is used in various places in the bot, you'll need to maintain the API.
Here's some code I used for colours in my old bot:
var colors= {};
colors.special = {};
colors.special.Reset = "\x1b[0m",
colors.special.Bright = "\x1b[1m"
colors.special.Dim = "\x1b[2m"
colors.special.Underscore = "\x1b[4m"
colors.special.Blink = "\x1b[5m"
colors.special.Reverse = "\x1b[7m"
colors.special.Hidden = "\x1b[8m"
colors.text = {};
colors.text.Black = "\x1b[30m"
colors.text.Red = "\x1b[31m"
colors.text.Green = "\x1b[32m"
colors.text.Yellow = "\x1b[33m"
colors.text.Blue = "\x1b[34m"
colors.text.Magenta = "\x1b[35m"
colors.text.Cyan = "\x1b[36m"
colors.text.White = "\x1b[37m"
colors.back = {};
colors.back.Black = "\x1b[40m"
colors.back.Red = "\x1b[41m"
colors.back.Green = "\x1b[42m"
colors.back.Yellow = "\x1b[43m"
colors.back.Blue = "\x1b[44m"
colors.back.Magenta = "\x1b[45m"
colors.back.Cyan = "\x1b[46m"
colors.back.White = "\x1b[47m"
module.exports = colors;
Horrible formatting, but this code is very old, with a little editing it could be much easier to use, removing the need for chalk.