manakin
The quickest and safest way to set default colorful output for your Node.js console, without messing with the colors, and to continue using the rich syntax and the output format supported by Node.js console methods:
• with a list of parameters: console.log(obj1 [, obj2, ..., objN]);
• with message formatting: console.log(msg [, subst1, ..., substN]);
Can be used either locally or globally (by overriding the console
object), with automatic colors applied according to which
method is used - see the screenshot below.
minimum code ✔ no dependencies ✔
This library provides consistent output format for console methods after applying the colors, in contrast to generic color libraries that only apply colors to text.
Installing
$ npm install manakin --save
Usage
Using colors globally
global; // sets colors globally, for the `console` object console; // white/default text outputconsole; // yellow text outputconsole; // red text outputconsole; // cyan text outputconsole; // green text output (custom method)console; // green text output (custom method)
Using colors locally
var con = local; // use colors locally con; // white/default text outputcon; // yellow text outputcon; // red text outputcon; // cyan text outputcon; // green text output (custom method)con; // green text output (custom method)
Customization Features
You can easily do the following:
- change brightness individually for each available method
- override predefined colors for existing methods
- create custom-color methods, with the same output formatting
For more details and examples, see the full API and examples.
License
Copyright © 2018 Vitaly Tomilov; Released under the MIT license.