colorprint
Print ansi-colored message to stdout/stderr.
Installation
npm install colorprint --save
Usage
"use strict"; const colorpint = colorpint //Pipe to stdout with magenta color.colorpint //Pipe to stdout with green color.colorpint //Pipe to stdout with color.colorpint //Pipe to stdout with white color.colorpint //Pipe to stdout with yellow color.colorpint //Pipe to stderr with red color.colorpint //Pipe to stderr with bgRed color.
Using via CIL
Install globally
$ npm install colorprint -g
From Command Line
#!/bin/bash colorpint notice "This is NOTICE from CLI" # Pipe to stdout with magenta color. colorpint info "This is INFO from CLI" # Pipe to stdout with green color. colorpint debug "This is DEBUG from CLI" # Pipe to stdout with color. colorpint trace "This is TRACE from CLI" # Pipe to stdout with white color. colorpint warn "This is WARN from CLI" # Pipe to stdout with yellow color. colorpint error "This is ERROR from CLI" # Pipe to stderr with red color. colorpint fatal "This is FATAL from CLI" # Pipe to stderr with bgRed color.
Customizing
Customize the whole module.
"use strict"; const colorprint = ;colorprintPREFIX='Yeah!';colorprintINFO_COLOR='blue';colorprint;
Create new context to customize.
"use strict"; const Colorprint = ;let colorprint = PREFIX: '[Foo]' INFO_COLOR: 'blue';colorprint;
colorprint is using cli-color for coloring and you can see available colors here.
License
This software is released under the MIT License.