📝 Edit page
➕ Add page
Color
Printing terminal text with color and style formatting
Chalk
Terminal string styling done right
A popular choice is chalk
.
chalk on NPM.
Usage
Examples from the docs.
const chalk = require('chalk');
console.log(chalk.blue('Hello world!'));
const chalk = require('chalk');
const log = console.log;
// Combine styled and normal strings
log(chalk.blue('Hello') + ' World' + chalk.red('!'));
// Compose multiple styles using the chainable API
log(chalk.blue.bgRed.bold('Hello world!'));
// Pass in multiple arguments
log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));