Color marking of console in NodeJS

When using NodeJS, I found that the colors are the same when looking at the console, so if you want to correctly mark the content you want to mark, you need to use the colors component

First you need to install:

npm install -g colors

After the installation is complete, the following prompt will appear:

+ [email protected]

added 1 package in 4.295s

Description has been installed successfully

then in your js file add

let colors = require( "colors");

indicates that the component has been referenced into the program,

Use as follows:

console.log('rainbow_onstarted'.red);


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324852018&siteId=291194637