chalk: It's not working on my mac (10.11.5)
This is my code:
const chalk = require('chalk');
console.log(chalk.red('TOTOTOTOT'));
console.log(chalk.blue('Hello world!'));
It just prints white text in iTerm and Terminal
package.json
"chalk": "^1.1.3",
What am I doing wrong here?
Thanks
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 20 (8 by maintainers)
When you run your script, run it like this:
Does it output color?
Yes. The child process is piped to the parent process which makes
isatty()
return0
(false) within the child process, shutting off colored output thanks tosupports-color
returning afalse
-ey result.Pass an
env
entry withFORCE_COLOR=1
to the child.Some pseudo-code:
That should get you what you want (barring weird edge-cases).
Hope that helps 💃