Add colours and style to the node.js console output.
https://www.npmjs.org/package/colors, but it modifies String.prototype
and is therefore wrong.
$ npm install console-style
var style = require('console-style');
// Output bold, underlined and red text
console.log( style.bold.underline.red('Hello world') );
The arguments applied to the style are passed to util.format
. This means objects will be inspected, and placeholders can be used.
// Alternative syntax
console.log( style( 'Hello world', [ 'bold', 'underline', 'red' ] ) );
This syntax does not use util.format
.
See http://en.wikipedia.org/wiki/ANSI_colors#Colors
- bold
- italic - not widely supported
- underline
- inverse
- strikethough - not widely supported
- white
- black
- blue
- cyan
- green
- magenta
- red
- yellow
- whiteBG
- blackBG
- blueBG
- cyanBG
- greenBG
- magentaBG
- redBG
- yellowBG