bevacqua bevacqua - 1 year ago 50
Node.js Question

Formatting lost down the pipes

You can give it a ride yourself, below is the code in copy-able format.



var chalk = require('chalk');


setTimeout(function () {
console.log('Right after!'));
}, 400);

setTimeout(function () {
process.stdout.write('And ' + chalk.magenta('...'));

setTimeout(function () {
console.log(chalk.underline('it\'s gone!'));
}, 2000);
}, 5000);

Then there's


enter image description here

How can I preserve color formatting through these pipes?

Answer Source

So far as I can tell, Chalk disables colour support when not writing to a TTY. It looks like you need to supply the --color arg.

You can also set the environment variable FORCE_COLOR=1 to force colors for anything that uses Chalk.