Detect whether a terminal supports color.
Used in the terminal color module chalk.
Install with npm: npm install --save has-color
var hasColor = require('has-color');
if (hasColor) {
console.log('Terminal supports color.');
}
It obeys the CLI flags --color
and --no-color
.
MIT © Sindre Sorhus