Return a new Chalk instance.
Readonly
bgReadonly
bgReadonly
bgReadonly
bgReadonly
bgReadonly
bgReadonly
bgReadonly
bgReadonly
bgReadonly
bgReadonly
bgReadonly
bgReadonly
bgReadonly
bgReadonly
bgReadonly
bgReadonly
bgReadonly
bgReadonly
black: Core.colors.ChalkReadonly
blackReadonly
blue: Core.colors.ChalkReadonly
blueReadonly
bold: Core.colors.ChalkModifier: Make text bold.
Readonly
cyan: Core.colors.ChalkReadonly
cyanReadonly
dim: Core.colors.ChalkModifier: Emitting only a small amount of light.
Readonly
gray: Core.colors.ChalkReadonly
green: Core.colors.ChalkReadonly
greenReadonly
grey: Core.colors.ChalkReadonly
hidden: Core.colors.ChalkModifier: Prints the text, but makes it invisible.
Readonly
inverse: Core.colors.ChalkModifier: Inverse background and foreground colors.
Readonly
italic: Core.colors.ChalkModifier: Make text italic. (Not widely supported)
The color support for Chalk.
By default, color support is automatically detected based on the environment.
Levels:
0
- All colors disabled.1
- Basic 16 colors support.2
- ANSI 256 colors support.3
- Truecolor 16 million colors support.Readonly
magenta: Core.colors.ChalkReadonly
magentaReadonly
red: Core.colors.ChalkReadonly
redReadonly
reset: Core.colors.ChalkModifier: Resets the current color chain.
Readonly
strikethrough: Core.colors.ChalkModifier: Puts a horizontal line through the center of the text. (Not widely supported)
Readonly
underline: Core.colors.ChalkModifier: Make text underline. (Not widely supported)
Readonly
visible: Core.colors.ChalkModifier: Prints the text only when Chalk has a color support level > 0. Can be useful for things that are purely cosmetic.
Readonly
white: Core.colors.ChalkReadonly
whiteReadonly
yellow: Core.colors.ChalkReadonly
yellowUse a Select/Set Graphic Rendition (SGR) color code number to set text color.
30 <= code && code < 38 || 90 <= code && code < 98 For example, 31 for red, 91 for redBright.
Use a Select/Set Graphic Rendition (SGR) color code number to set background color.
30 <= code && code < 38 || 90 <= code && code < 98 For example, 31 for red, 91 for redBright. Use the foreground code, not the background code (for example, not 41, nor 101).
Use a template string.
Rest
...placeholders: unknown[]Template literals are unsupported for nested calls (see issue #341)
import chalk = require('chalk');
log(chalk`
CPU: {red ${cpu.totalPercent}%}
RAM: {green ${ram.used / ram.total * 100}%}
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
`);
import chalk = require('chalk');
log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`)
Rest
...text: unknown[]Generated using TypeDoc
Main Chalk object that allows to chain styles together. Call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that
chalk.red.yellow.green
is equivalent tochalk.green
.