You can give it a ride yourself, below is the code in copy-able format.
Here's chalked.js
var chalk = require('chalk');
console.log('Immediately!');
setTimeout(function () {
console.log(chalk.red('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 piper.js
process.stdin.pipe(process.stdout);
How can I preserve color formatting through these pipes?
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.