> Terminal string styling done right [![Build Status](]( [![Coverage Status](]( [![npm dependents](]( [![Downloads](]( [![](]( [![XO code style](]( ![TypeScript-ready]( [![run on](](

Sindre Sorhus' open source work is supported by the community on GitHub Sponsors and Dev

Special thanks to:

All your environment variables, in one place
Stop struggling with scattered API keys, hacking together home-brewed tools,
and avoiding access controls. Keep your team and servers in sync with Doppler.

UI Bakery

## Highlights - Expressive API - Highly performant - Ability to nest styles - [256/Truecolor color support](#256-and-truecolor-color-support) - Auto-detects color support - Doesn't extend `String.prototype` - Clean and focused - Actively maintained - [Used by ~50,000 packages]( as of January 1, 2020 ## Install ```console $ npm install chalk ``` ## Usage ```js const chalk = require('chalk'); console.log('Hello world!')); ``` Chalk comes with an easy to use composable API where you just chain and nest the styles you want. ```js const chalk = require('chalk'); const log = console.log; // Combine styled and normal strings log('Hello') + ' World' +'!')); // Compose multiple styles using the chainable API log('Hello world!')); // Pass in multiple arguments log('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')); // Nest styles log('Hello', chalk.underline.bgBlue('world') + '!')); // Nest styles of the same type even (color, underline, background) log( 'I am a green line ' +'with a blue substring') + ' that becomes green again!' )); // ES2015 template literal log(` CPU: ${'90%')} RAM: ${'40%')} DISK: ${chalk.yellow('70%')} `); // ES2015 tagged template literal log(chalk` CPU: {red ${cpu.totalPercent}%} RAM: {green ${ram.used / * 100}%} DISK: {rgb(255,131,0) ${disk.used / * 100}%} `); // Use RGB colors in terminal emulators that support it. log(chalk.keyword('orange')('Yay for orange colored text!')); log(chalk.rgb(123, 45, 67).underline('Underlined reddish color')); log(chalk.hex('#DEADED').bold('Bold gray!')); ``` Easily define your own themes: ```js const chalk = require('chalk'); const error =; const warning = chalk.keyword('orange'); console.log(error('Error!')); console.log(warning('Warning!')); ``` Take advantage of console.log [string substitution]( ```js const name = 'Sindre'; console.log('Hello %s'), name); //=> 'Hello Sindre' ``` ## API ### chalk.`