node package manager
It’s your turn. Help us improve JavaScript. Take the 2017 JavaScript Ecosystem Survey »



Simplifies the working with console colors in Node.js


$ npm install curly-colors

How to include

    var cc = require('curly-colors');

Available Colors

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • grey

Available Styles

  • bold for bold size text
  • italic for italic text
  • underline for underlined text
  • blink for blinking text
  • inverse to inverse the colors


Simple colors

    console.log(cc('<{red>red text<}>'));

Multiple colors

    console.log(cc('<{red>red text<}> <{green>green text<}>'));

Nested colors

    console.log(cc('<{red>red text <{green>green text<}> red text<}>'));
    console.log(cc('<{red>red <{green>green <{bold>bold green<}> green<}> red<}>'));

The final console output looks like this

Console Screenshot

printf-style usage

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);