Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

chalk-styler

Terminal string styling done beautifully with ANSI codes, inspired by Chalk.js

chalk, ansi-colors, terminal-colors, terminal-styling, console-colors, console-styling, cli, cli-colors, text-styling, string-styling, text-color, colorize, command-line, chalk-alternative, chalk-style, terminal, nodejs, node-cli

readme

🌈 chalk-styler

chalk-styler is a simple, chainable terminal string styling library for adding colors and text styles (bold, underline, italic, background colors, and more) to console output using ANSI escape codes — inspired by Chalk.js.

🚀 Installation

npm install chalk-styler

or

yarn add chalk-styler

✨ Features

  • Chainable API for styling text.
  • Supports:
    • Standard colors and background colors.
    • Bright colors.
    • Text modifiers (bold, underline, italic, etc.).
    • RGB, HEX, and ANSI256 colors.

📦 Usage

import chalk from 'chalk-styler';

// Simple color
console.log(chalk.green('This is green text'));

// Color + Bold
console.log(chalk.red.bold('Bold Red Text'));

// Combined styles (inverse + bold + white)
console.log(chalk.white.bold.inverse('White text with inverse and bold'));

// HEX color + underline
console.log(chalk.hex('#FF5733').underline('Hex color underline'));

// RGB color + italic
console.log(chalk.rgb(255, 255, 0).italic('Yellowish italic text'));

🎨 Available Styles

✅ Modifiers

Modifier Description
bold Bold text
dim Dimmed color
italic Italic text
underline Underlined text
overline Overlined text
inverse Inverse background/text
hidden Hidden text
strikethrough Strikethrough text
reset Reset styles

✅ Colors

Standard Colors Bright Variants
black blackBright, gray
red redBright
green greenBright
yellow yellowBright
blue blueBright
magenta magentaBright
cyan cyanBright
white whiteBright

✅ Background Colors

Standard Backgrounds Bright Backgrounds
bgBlack bgBlackBright, bgGray
bgRed bgRedBright
bgGreen bgGreenBright
bgYellow bgYellowBright
bgBlue bgBlueBright
bgMagenta bgMagentaBright
bgCyan bgCyanBright
bgWhite bgWhiteBright

✅ RGB, HEX, ANSI256

chalk.rgb(255, 0, 0)('Red color using RGB');
chalk.hex('#00FF00')('Green color using HEX');
chalk.ansi256(200)('Color using ANSI256');

⚙️ API

  • chalk.color('text'): Apply color.
  • chalk.modifier('text'): Apply modifier (bold, italic, etc.).
  • chalk.bgColor('text'): Apply background color.
  • chalk.hex('#RRGGBB')('text'): HEX color.
  • chalk.rgb(r, g, b)('text'): RGB color.
  • chalk.ansi256(n)('text'): ANSI256 color.
  • Chain any of the above for combined styles.

📝 Example

console.log(
 chalk.bgBlue.white.bold.italic('Bold, italic white text on blue background')
);

✅ License

MIT License