colors.js - get color and style in your node.js console ( and browser ) like what

colors.js - get color and style in your node.js console ( and browser ) like what - 图1

Installation

  1. npm install colors

colors and styles!

  • bold
  • italic
  • underline
  • inverse
  • yellow
  • cyan
  • white
  • magenta
  • green
  • red
  • grey
  • blue
  • rainbow
  • zebra
  • random

Usage

  1. var colors = require('./colors');
  2. console.log('hello'.green); // outputs green text
  3. console.log('i like cake and pies'.underline.red) // outputs red underlined text
  4. console.log('inverse the color'.inverse); // inverses the color
  5. console.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces)

Creating Custom themes

  1. var colors = require('colors');
  2. colors.setTheme({
  3. silly: 'rainbow',
  4. input: 'grey',
  5. verbose: 'cyan',
  6. prompt: 'grey',
  7. info: 'green',
  8. data: 'grey',
  9. help: 'cyan',
  10. warn: 'yellow',
  11. debug: 'blue',
  12. error: 'red'
  13. });
  14. // outputs red text
  15. console.log("this is an error".error);
  16. // outputs yellow text
  17. console.log("this is a warning".warn);

Contributors

Marak (Marak Squires) Alexis Sellier (cloudhead) mmalecki (Maciej Małecki) nicoreed (Nico Reed) morganrallen (Morgan Allen) JustinCampbell (Justin Campbell) ded (Dustin Diaz)

, Marak Squires , Justin Campbell, Dustin Diaz (@ded)