const ANSI_COLORS = { "reset": "", "black": "", "red": "", "green": "", "yellow": "", "blue": "", "magenta": "", "cyan": "", "white": "" } const ALIASES = { "b": "black", "r": "red", "g": "green", "y": "yellow", "bl": "blue", "m": "magenta", "c": "cyan", "w": "white", "rs": "reset" } module.exports.format = function(text, color){ if(!ANSI_COLORS[color] && !ALIASES[color]) throw "Invalid ANSI Color" if(!ANSI_COLORS[color]) color = ALIASES[color] return `${ANSI_COLORS[color]}${text}${ANSI_COLORS.reset}` }