How to record a color message with Yeomen?

I tried console.log('message') , but it returns the message in black.

Is there a way to write a message in color in a generator?

+4
source share
2 answers

You can use the same Chalk color module that the generator system uses to colorize your text.

Install it first: npm install --save chalk

Then:

 var chalk = require('chalk'); console.log(chalk.bold.yellow('message')); 
+10
source

For new users viewing this question console.log(); should never be used in Yeoman, according to the documentation . use generator.log(); instead generator.log(); mostly in practice like this.log() .

enter image description here

+1
source

Source: https://habr.com/ru/post/1498165/


All Articles