Sometimes we need to show different command lines out of different colors. Here is a solution which I found, which can helpful for other developers too.
Asked
Active
Viewed 669 times
1
-
... and if you want different colors for messages generated via npm scripts - refer to [this answer](https://stackoverflow.com/questions/50226385/apply-visual-styling-to-echo-commands-used-in-npm-scripts-via-package-json/50275198#50275198). – RobC Jul 05 '20 at 08:48
2 Answers
0
First, install it to the directory you'd like to work in.
npm install colors
Now open up a little test script for yourself, and try something like this:
const colors = require('colors');
const string1 = 'This string is red.'.red;
const string2 = 'This string is blue.'.blue;
console.log(string1);
console.log(stringThree);

Santosh Kori
- 461
- 4
- 12