Node: Colorise Terminal Strings with Chalk

Chalk is a JavaScript library for colorising the strings that you write to the terminal. It has a large number of uses from applications to debugging.

chalk node npm javascript

Chalk is a JavaScript library for colorising the strings that you write to the terminal. It has a large number of uses from applications to debugging.

Easy to Use

const chalk = require(‘chalk’);
console.log(chalk.green(‘Green is the color!’));

Forecolor e.g: black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright

Backcolor e.g: bgBlack, bgRed, bgGreen, bgYellow,bgBlue, bgMagenta, bgCyan, bgWhite, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright

Modifiers e.g: bold, dim, underline, inverse

Chainable:
chalk.red.underline.bold(‘some text’);

Define simple themes:

const chalk = require(‘chalk’);
const error = chalk.bold.red;
const warning = chalk.keyword(‘orange’);
console.log(error(‘Error!’));
console.log(warning(‘Warning!’));
templates like {cyan.bold ${func(x)} sometext}

256 and Truecolor support.

License: Chalk is licensed under MIT.
Popularity: Huge. Chalk has about 13+ million downloads per week and used in over 23,000 packages.

chalk example

Where to Find Chalk

On npm: https://www.npmjs.com/package/chalk

On github: https://github.com/chalk/chalk

Recommended Installation:
npm install chalk