node-colorify
(color & style texts in console)
A node library for printing colored and styled texts in terminal. Uses ANSI color and style codes to format the color and style printed on console. node-colorify is easy to use and supports additional text formatting.
Install
$ npm install node-colorify
Require as follows:
var color = ;
Usage Example
var color = ; //colorIt - Synchronouslyconsole;console; //colorIt - Asynchronouslycolor;color; //styleIt - Synchronouslyconsole;console; //styleIt - Asynchronouslycolor;color;
Output
API Documentation
colorIt(text, color, callback)
- Asynchronous
This function will return the ANSI formatted string of given color asynchronously.
color
Color format can be specified as follows
bColor
- Background Color
fColor
- Foreground Color
Foreground alone:
'fColor': 'black'
Background alone:
'bColor': 'red'
Mixed format:
'fColor': 'black' 'bColor': 'red'
Supported list of colors:
1. BLACK (DEFAULT)
2. RED
3. GREEN
4. YELLOW
5. BLUE
6. MAGENTA
7. CYAN
8. WHITE
colorItSync(text, color)
- Synchronous
Same as that of colorit functionality, returns the ANSI formatted string of given color synchronously.
styleIt(text, styles, callback)
- Asynchronous
This function will return the ANSI formatted string of given style asynchronously.
styles
Style can be specified as follows
Single style
"bold"
Multiple styles
"bold" "blink" "inverse"
Supported list of styles:
1. BOLD
2. LIGHT
3. ULINE (UNDERLINE)
4. BLINK
5. INVERSE
6. HIDE
styleItSync(text, styles)
- Synchronous
Same as that of styleIt functionality, returns the ANSI style formatted string of given style synchronously.