JSPM

aschalk

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q5312F
  • License MIT

A beautiful terminal styling library with gradient support, designed for CLI tools and pretty logs.

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 text
  • ctr.green(text) - Green text
  • ctr.blue(text) - Blue text
  • ctr.yellow(text) - Yellow text
  • ctr.magenta(text) - Magenta text
  • ctr.cyan(text) - Cyan text
  • ctr.white(text) - White text
  • ctr.black(text) - Black text
  • ctr.gray(text) / ctr.grey(text) - Gray text

Text Styling

  • ctr.bold(text) - Bold text
  • ctr.dim(text) - Dim text
  • ctr.italic(text) - Italic text
  • ctr.underline(text) - Underlined text
  • ctr.strikethrough(text) - Strikethrough text

Background Colors

  • ctr.bgRed(text) - Red background
  • ctr.bgGreen(text) - Green background
  • ctr.bgBlue(text) - Blue background
  • ctr.bgYellow(text) - Yellow background
  • ctr.bgMagenta(text) - Magenta background
  • ctr.bgCyan(text) - Cyan background
  • ctr.bgWhite(text) - White background
  • ctr.bgBlack(text) - Black background

Gradient Methods

  • ctr.gradient(text, colors) - Custom gradient with array of colors
  • ctr.rainbow(text) - Rainbow gradient
  • ctr.sunset(text) - Sunset gradient (orange to pink)
  • ctr.morning(text) - Morning gradient (light green to pink)

Styled Messages

  • ctr.success(text) - Green checkmark with text
  • ctr.error(text) - Red X with text
  • ctr.info(text) - Blue info icon with text
  • ctr.warn(text) - Yellow warning icon with text

Advanced Colors

  • ctr.hex(color, text) - Custom hex color
  • ctr.rgb(r, g, b, text) - Custom RGB color
  • ctr.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

🤝 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)