fancy-console

0.1.7 • Public • Published

fancy-console

NPM Version Node.js Version

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:

NameRenderMethod
critText in bold italic purple`function crit(message, args);`
errorText in red`function error(message, args);`
warnText in yellow`function warn(message, args);`
infoText in cyan`function info(message, args);`
successText in green`function success(message, args);`
logText in white`function log(message, args);`

Colors and styles

Available colors:

ColorRenderAttribute
BlackText in blackfc.colors.black
RedText in redfc.colors.red
YellowText in yellowfc.colors.yellow
GreenText in greenfc.colors.greeb
BlueText in bluefc.colors.blue
PurpleText in purplefc.colors.purple
CyanText in cyanfc.colors.cyan
WhiteText in whitefc.colors.white

Available styles:

StyleRenderAttribute
BoldText in boldfc.styles.bold
ItalicText in italicfc.styles.italic
UnderlineText underlinefc.styles.underline
StrikeText strikefc.styles.strike
InverseText with backgroundfc.styles.bold

License

MIT

Dependents (0)

Package Sidebar

Install

npm i fancy-console

Weekly Downloads

1

Version

0.1.7

License

MIT

Last publish

Collaborators

  • franckysolo