yeomanterminal-color

How to log a colored message with Yeoman?


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

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


Solution

  • You can use the same color module Chalk as used by the generator system to colorize your text.

    First install it:npm install --save chalk

    Then:

    var chalk = require('chalk');
    this.log(chalk.bold.yellow('message'));