Text formatting modifiers for controlling the appearance of terminal text including bold, italic, underline, and color inversion effects.
Resets all currently applied styles to default terminal appearance.
/**
* Reset the current style to terminal defaults
* @returns ChalkInstance for method chaining
*/
readonly reset: ChalkInstance;Usage Example:
import chalk from 'chalk';
console.log(chalk.red.bold('Red bold text') + chalk.reset(' Normal text'));Makes text appear bold/thick in terminals that support it.
/**
* Make text bold (increased font weight)
* @returns ChalkInstance for method chaining
*/
readonly bold: ChalkInstance;Usage Example:
import chalk from 'chalk';
console.log(chalk.bold('This text is bold'));
console.log(chalk.red.bold('This is bold red text'));Reduces the opacity/brightness of text for a faded appearance.
/**
* Make text have lower opacity (dimmed appearance)
* @returns ChalkInstance for method chaining
*/
readonly dim: ChalkInstance;Usage Example:
import chalk from 'chalk';
console.log(chalk.dim('This text appears faded'));
console.log(chalk.blue.dim('Dimmed blue text'));Makes text appear in italic font style. Note: Not widely supported across all terminals.
/**
* Make text italic (slanted font style)
* Note: Not widely supported across terminals
* @returns ChalkInstance for method chaining
*/
readonly italic: ChalkInstance;Usage Example:
import chalk from 'chalk';
console.log(chalk.italic('Italic text (if supported)'));
console.log(chalk.green.italic('Green italic text'));Adds a horizontal line below the text. Note: Not widely supported across all terminals.
/**
* Put a horizontal line below the text
* Note: Not widely supported across terminals
* @returns ChalkInstance for method chaining
*/
readonly underline: ChalkInstance;Usage Example:
import chalk from 'chalk';
console.log(chalk.underline('Underlined text'));
console.log(chalk.red.underline('Red underlined text'));Adds a horizontal line above the text. Note: Not widely supported across all terminals.
/**
* Put a horizontal line above the text
* Note: Not widely supported across terminals
* @returns ChalkInstance for method chaining
*/
readonly overline: ChalkInstance;Usage Example:
import chalk from 'chalk';
console.log(chalk.overline('Overlined text (if supported)'));Swaps the foreground and background colors for a highlighting effect.
/**
* Invert background and foreground colors
* @returns ChalkInstance for method chaining
*/
readonly inverse: ChalkInstance;Usage Example:
import chalk from 'chalk';
console.log(chalk.inverse('Inverted text'));
console.log(chalk.red.inverse('Red background with default foreground'));Makes text invisible while still occupying space in the terminal.
/**
* Print the text but make it invisible
* @returns ChalkInstance for method chaining
*/
readonly hidden: ChalkInstance;Usage Example:
import chalk from 'chalk';
console.log('Visible text' + chalk.hidden(' hidden text ') + 'more visible text');Adds a horizontal line through the center of the text. Note: Not widely supported across all terminals.
/**
* Put a horizontal line through the center of the text
* Note: Not widely supported across terminals
* @returns ChalkInstance for method chaining
*/
readonly strikethrough: ChalkInstance;Usage Example:
import chalk from 'chalk';
console.log(chalk.strikethrough('Struck through text'));
console.log(chalk.red.strikethrough('Red struck through text'));Only displays text when Chalk's color level is above zero. Useful for cosmetic-only text.
/**
* Print the text only when Chalk has a color level above zero
* Can be useful for things that are purely cosmetic
* @returns ChalkInstance for method chaining
*/
readonly visible: ChalkInstance;Usage Example:
import chalk from 'chalk';
// This text only appears if colors are enabled
console.log(chalk.visible('Decorative symbols: ●○●'));
console.log(chalk.red.visible('Red decorative text'));
// Create instance with no color support
const noColorChalk = new chalk.Chalk({level: 0});
console.log(noColorChalk.visible('This will not appear'));All text styling modifiers can be chained together in any order:
import chalk from 'chalk';
console.log(chalk.bold.italic.underline('Multiple modifiers'));
console.log(chalk.red.bold.inverse('Red bold inverted text'));
console.log(chalk.dim.strikethrough.blue('Complex styling combination'));