print-colors
print-colors is a very lightweight library for printing colors to the console using a nice and easy to use syntax.
Import the module to your project:
const c = ;
To print to your console some "How to use" examples you can use the example()
, docs()
or help()
functions available with the library to print some example to the console.
const c = ; c;
In order to affect the color of the text printed to the console with the built in console.log()
function, you need to follow the following template:
console.log(c.(background or foreground).(light or dark).(color) + 'Some Text' + c.end);
Examples:
const c = ; console; console; console;
You can also have combinations of background and foreground colors like so:
console;
You can use this set of shortcuts for having a better syntax:
- bg = background
- fg = foreground
- l = light
- d = dark
- e = end
So in practice, the above examples can be shortted as follow:
console; console; console; console;
Supported colors:
- gray
- red
- green
- yellow
- blue
- pink
- cyan
- white
Note
The following library was tested with Windows CMD.exe. Colors might look different from one console to another since the console colors are many time can be configured by the user...