Package Exports
- aschalk
- aschalk/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (aschalk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
AsChalk 🎨
A beautiful terminal styling library with gradient support, designed for CLI tools and pretty logs.
Made by Relmzey (Nexta Development)
🚀 Installation
npm install aschalk
📖 Quick Start
const ctr = require("aschalk");
console.log(ctr.red("Error message"));
console.log(ctr.green("Success message"));
console.log(ctr.gradient("Beautiful gradient!", ["#ff0000", "#00ff00"]));
🎨 Features
- Easy to use - Simple API with intuitive method names
- Gradient support - Create beautiful color gradients
- Preset gradients - Rainbow, sunset, morning, and more
- Styled messages - Built-in success, error, info, and warning styles
- Full color support - Basic colors, background colors, hex, RGB, HSL
- Text styling - Bold, italic, underline, strikethrough, dim
- Method chaining - Chain multiple styles together
- CommonJS & ESM - Compatible with both module systems
🔥 Basic Usage
Basic Colors
const ctr = require("aschalk");
console.log(ctr.red("Red text"));
console.log(ctr.green("Green text"));
console.log(ctr.blue("Blue text"));
console.log(ctr.yellow("Yellow text"));
console.log(ctr.magenta("Magenta text"));
console.log(ctr.cyan("Cyan text"));
console.log(ctr.white("White text"));
console.log(ctr.gray("Gray text"));
Text Styling
console.log(ctr.bold("Bold text"));
console.log(ctr.italic("Italic text"));
console.log(ctr.underline("Underlined text"));
console.log(ctr.strikethrough("Strikethrough text"));
console.log(ctr.dim("Dim text"));
Background Colors
console.log(ctr.bgRed("Red background"));
console.log(ctr.bgGreen("Green background"));
console.log(ctr.bgBlue("Blue background"));
console.log(ctr.bgYellow("Yellow background"));
🌈 Gradient Magic
Custom Gradients
// Two colors
console.log(ctr.gradient("Hello World", ["#ff0000", "#00ff00"]));
// Multiple colors
console.log(ctr.gradient("Amazing!", ["#ff6b6b", "#4ecdc4", "#45b7d1"]));
Preset Gradients
console.log(ctr.rainbow("Rainbow colors!"));
console.log(ctr.sunset("Sunset vibes"));
console.log(ctr.morning("Morning light"));
💬 Styled Messages
Perfect for CLI tools and logging:
console.log(ctr.success("Task completed successfully"));
console.log(ctr.error("Something went wrong"));
console.log(ctr.info("Here's some information"));
console.log(ctr.warn("Be careful with this"));
🎯 Advanced Colors
Hex Colors
console.log(ctr.hex("#ff6b6b", "Custom hex color"));
RGB Colors
console.log(ctr.rgb(255, 107, 107, "Custom RGB color"));
HSL Colors
console.log(ctr.hsl(0, 100, 80, "Custom HSL color"));
📋 Complete API Reference
Basic Colors
ctr.red(text)
- Red textctr.green(text)
- Green textctr.blue(text)
- Blue textctr.yellow(text)
- Yellow textctr.magenta(text)
- Magenta textctr.cyan(text)
- Cyan textctr.white(text)
- White textctr.black(text)
- Black textctr.gray(text)
/ctr.grey(text)
- Gray text
Text Styling
ctr.bold(text)
- Bold textctr.dim(text)
- Dim textctr.italic(text)
- Italic textctr.underline(text)
- Underlined textctr.strikethrough(text)
- Strikethrough text
Background Colors
ctr.bgRed(text)
- Red backgroundctr.bgGreen(text)
- Green backgroundctr.bgBlue(text)
- Blue backgroundctr.bgYellow(text)
- Yellow backgroundctr.bgMagenta(text)
- Magenta backgroundctr.bgCyan(text)
- Cyan backgroundctr.bgWhite(text)
- White backgroundctr.bgBlack(text)
- Black background
Gradient Methods
ctr.gradient(text, colors)
- Custom gradient with array of colorsctr.rainbow(text)
- Rainbow gradientctr.sunset(text)
- Sunset gradient (orange to pink)ctr.morning(text)
- Morning gradient (light green to pink)
Styled Messages
ctr.success(text)
- Green checkmark with textctr.error(text)
- Red X with textctr.info(text)
- Blue info icon with textctr.warn(text)
- Yellow warning icon with text
Advanced Colors
ctr.hex(color, text)
- Custom hex colorctr.rgb(r, g, b, text)
- Custom RGB colorctr.hsl(h, s, l, text)
- Custom HSL color
Chaining (Future Feature)
ctr.chain()
- Returns chainable instance for combining styles
🏗️ CLI Tool Example
#!/usr/bin/env node
const ctr = require("aschalk");
console.log(ctr.gradient("My Awesome CLI Tool", ["#667eea", "#764ba2"]));
console.log("");
console.log(ctr.success("Connected to database"));
console.log(ctr.info("Processing 1,234 records"));
console.log(ctr.warn("Rate limit approaching"));
console.log(ctr.error("Failed to upload file"));
console.log("");
console.log(ctr.rainbow("Thanks for using our tool!"));
🚀 Try It Out
Run the included demo to see all features:
npm install aschalk
node node_modules/aschalk/examples/demo.js
📦 Package Info
- Size: Lightweight and fast
- Dependencies: chalk@4.1.2, gradient-string@2.0.2
- Node.js: Requires Node.js 12.0.0 or higher
- License: MIT
🤝 Contributing
This package was created by Relmzey (Nexta Development).
Feel free to report issues or suggest improvements!
📄 License
MIT License - feel free to use in your projects!
Made with ❤️ by Relmzey (Nexta Development)