To use Colors module first we have to install it using Npm.
$ npm install colors
Now, we can start the Node.js (REPL) and do some coloring to console.
> console.log("Hello, How are you today?" .rainbow.bold);
The style only applies for one message, we need to apply another style for another message.
Color Modules is useful when we need to provide specific formatting for various events, such as providing one color for errors in one module, another for warning and another one for success.
How can we achieve this, lets see
..... warnMessage : 'yellow',
..... errorMessage : 'red',
..... successMessage : 'green'
Like this we can use the color theme in our console.
Please Like and Share the Blog, if you find it interesting and helpful.