console-style
v0.1.2
Published
Colour and style your console output
Downloads
5,101
Readme
Add colour to the console
Add colours and style to the node.js console output.
Alternatives
https://www.npmjs.org/package/colors, but it modifies String.prototype
and is therefore wrong.
Intallation
$ npm install console-style
Usage
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
.
Options
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