@sheet-i18n/ansi-color
v0.6.1
Published
ANSI color codes(light version of chalk)
Downloads
84
Readme
@sheet-i18n/ansi-color 🎨
A lightweight ANSI color utility for Node.js, inspired by Chalk! 🚀
✨ Features
- Minimal and fast 🏃💨
- Supports chaining styles dynamically ✨
- Uses ANSI escape codes for styling terminal text 🎨
- Lightweight alternative to Chalk ⚡
- Fully typed with TypeScript 🛠️
📦 Installation
npm install @sheet-i18n/ansi-coloror
pnpm add @sheet-i18n/ansi-color🚀 Usage
import { chalk } from '@sheet-i18n/ansi-color';
console.log(chalk.red('Error: Something went wrong!'));
console.log(chalk.green.bold('Success: Operation completed!'));
console.log(chalk.blue.bgYellow('Warning: Check your input.'));🔹 Chaining Styles
You can chain multiple styles together seamlessly:
console.log(chalk.bold.cyan('Bold and cyan!'));
console.log(chalk.red.bgWhite.bold('Red text with white background and bold!'));🔹 Available Colors & Styles
| Style | ANSI Code |
| ----------- | ---------- |
| bold | \x1b[1m |
| black | \x1b[30m |
| red | \x1b[31m |
| green | \x1b[32m |
| yellow | \x1b[33m |
| blue | \x1b[34m |
| magenta | \x1b[35m |
| cyan | \x1b[36m |
| white | \x1b[37m |
| gray | \x1b[90m |
| bgBlack | \x1b[40m |
| bgRed | \x1b[41m |
| bgGreen | \x1b[42m |
| bgYellow | \x1b[43m |
| bgBlue | \x1b[44m |
| bgMagenta | \x1b[45m |
| bgCyan | \x1b[46m |
| bgWhite | \x1b[47m |
🛠️ API
chalk.<color>(text: string): string
Applies the specified color to the text.
console.log(chalk.red('This is red'));chalk.<color>.<style>(text: string): string
Applies multiple styles to the text.
console.log(chalk.blue.bold('This is bold and blue!'));chalk.bg<Color>(text: string): string
Applies a background color.
console.log(chalk.bgYellow.black('Black text on yellow background'));📜 License
This project is licensed under the ISC License.
👤 Author
devAnderson
📧 [email protected]
🌍 GitHub Profile
🚀 Enjoy styling your terminal output with @sheet-i18n/ansi-color! 🎨
