README
fancy-console
Colorize JavaScript console messages, a fancy tool for Node command line
Installation
Locally:
npm install fancy-console --save
Globally:
npm install -g fancy-console
To run the test inside the module:
cd node_modules/fancy-console
npm test
How to use it?
var fc = require('fancy-console')
// Access to console with fc.cmd
fc.cmd.time('my-timer')
// Some colorized messages
fc.crit('critical message in purple bold italic')
fc.error('error message in red')
fc.warn('warn message in yellow')
fc.info('info message in cyan')
fc.success('success message in green')
fc.log('log message in white')
var myStyle = fc.styles.inverse + fc.colors.blue;
fc.colorize('A custom message in background blue', myStyle)
// Message with parameter
var myVar = 15;
fc.log('the value of my var is %d', myVar)
fc.cmd.timeEnd('my-timer')
Pre-defined messages:
Name | Render | Method |
---|---|---|
crit | Text in bold italic purple | `function crit(message, args);` |
error | Text in red | `function error(message, args);` |
warn | Text in yellow | `function warn(message, args);` |
info | Text in cyan | `function info(message, args);` |
success | Text in green | `function success(message, args);` |
log | Text in white | `function log(message, args);` |
Colors and styles
Available colors:
Color | Render | Attribute |
---|---|---|
Black | Text in black | fc.colors.black |
Red | Text in red | fc.colors.red |
Yellow | Text in yellow | fc.colors.yellow |
Green | Text in green | fc.colors.greeb |
Blue | Text in blue | fc.colors.blue |
Purple | Text in purple | fc.colors.purple |
Cyan | Text in cyan | fc.colors.cyan |
White | Text in white | fc.colors.white |
Available styles:
Style | Render | Attribute |
---|---|---|
Bold | Text in bold | fc.styles.bold |
Italic | Text in italic | fc.styles.italic |
Underline | Text underline | fc.styles.underline |
Strike | fc.styles.strike | |
Inverse | Text with background | fc.styles.bold |