Last active
December 20, 2015 14:06
-
-
Save olivif/68bc3ba6838e32bd2b6e to your computer and use it in GitHub Desktop.
node-couleurs windows fix prototype
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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