0.1.2 • Published 9 years ago

console-style v0.1.2

Weekly downloads
2,409
License
MIT
Repository
github
Last release
9 years ago

Add colour to the console

npm version

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