Simplifies the working with console colors in Node.js
$ npm install curly-colors
var cc = require('curly-colors');
black
red
green
yellow
blue
magenta
cyan
white
grey
bold
for bold size textitalic
for italic textunderline
for underlined textblink
for blinking textinverse
to inverse the colors
console.log(cc('<{red>red text<}>'));
console.log(cc('<{red>red text<}> <{green>green text<}>'));
console.log(cc('<{red>red text <{green>green text<}> red text<}>'));
console.log(cc('<{red>red <{green>green <{bold>bold green<}> green<}> red<}>'));
This should be used when performance is important.
var fs = require('fs');
var cc = require('curly-colors');
var dir = './';
var format = cc('<{yellow>%d<}> <{magenta>%s<}>');
fs.readdirSync(dir).forEach(function(filename) {
var stat = fs.lstatSync(filename);
console.log(format, stat.size, filename);
});
If you need you can also pass the parameters directly to curly-colors
var result = cc("You're using <{blue>Node<}> <{magenta>%s<}>", process.version);
console.log(result);