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:
Tag | Description | ANSI |
---|---|---|
<black> |
black text | 30 |
<red> |
red text | 31 |
<green> |
green text | 32 |
<yellow> |
yellow text | 33 |
<blue> |
blue text | 34 |
<magenta> |
magenta text | 35 |
<cyan> |
cyan text | 36 |
<white> |
white text | 37 |
<grey> |
grey text | 90 |
<bg-black> |
black background | 40 |
<bg-red> |
red background | 41 |
<bg-green> |
green background | 42 |
<bg-yellow> |
yellow background | 43 |
<bg-blue> |
blue background | 44 |
<bg-magenta> |
magenta background | 45 |
<bg-cyan> |
cyan background | 46 |
<bg-white> |
white background | 47 |
<bg-grey> |
grey background | 100 |
<b> |
bold | 1 |
<i> |
italics | 3 |
<u> |
underline | 4 |
<blink> |
flash text | 5 |
shellcolor is licensed under the permissive BSD license.