shellcolor

ANSI colors for your Node.js app's stdout, stderror, and logs

shellcolor

ANSI colors for your Node.js app's stdout, stderror, and logs

Get shellcolor with npm.

npm install shellcolor --save

Pass a bland string to shellcolor(), get a colorful string back.

var shellcolor = require('shellcolor');
 
console.log(shellcolor('<b><green>Success:<green></b> Process started.'));
  
console.warn(shellcolor('<b><yellow>Error:</yellow></b> Something seems wrong....'));
 
console.error(shellcolor('<b><red>Error:</red></b> Something broke.'));

The following tags are available:

TagDescriptionANSI
<black>black text30
<red>red text31
<green>green text32
<yellow>yellow text33
<blue>blue text34
<magenta>magenta text35
<cyan>cyan text36
<white>white text37
<grey>grey text90
<bg-black>black background40
<bg-red>red background41
<bg-green>green background42
<bg-yellow>yellow background43
<bg-blue>blue background44
<bg-magenta>magenta background45
<bg-cyan>cyan background46
<bg-white>white background47
<bg-grey>grey background100
<b>bold1
<i>italics3
<u>underline4
<blink>flash text5

shellcolor is licensed under the permissive BSD license.