Skip to content

Instantly share code, notes, and snippets.

@olivif
Last active December 20, 2015 14:06
Show Gist options
  • Save olivif/68bc3ba6838e32bd2b6e to your computer and use it in GitHub Desktop.
Save olivif/68bc3ba6838e32bd2b6e to your computer and use it in GitHub Desktop.
node-couleurs windows fix prototype
var styles = {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
gray: [90, 39],
grey: [90, 39]
};
function generateFgStyle(colorCodes, text) {
return "\u001b[" + colorCodes[0] + "m" + text + "\u001b[" + colorCodes[1] + "m";
}
function printStyles() {
for (var property in styles) {
if (styles.hasOwnProperty(property)) {
console.log(generateFgStyle(styles[property], "Text"));
}
}
}
printStyles();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment