js-log-color
v1.0.0
Published
A simple JavaScript library for colorful console outputs.
Maintainers
Readme
js-log-color 🎨
A tiny, zero-dependency utility for beautiful terminal colors in Node.js.
Installation
npm install js-log-color
Usage
import { log, Color } from 'js-log-color';
// Simple
log("Error!", Color.RED);
// Multi-color
log([
["[INFO] ", Color.WHITE],
["Server: ", Color.CYAN],
["ONLINE", Color.GREEN]
]);Available Colors
| Color | Constant | Hex Equivalent | | :------ | :------------ | :------------- | | Red | Color.RED | #FF0000 | | Green | Color.GREEN | #00FF00 | | Yellow | Color.YELLOW | #FFFF00 | | Blue | Color.BLUE | #0000FF | | Magenta | Color.MAGENTA | #FF00FF | | Cyan | Color.CYAN | #00FFFF | | White | Color.WHITE | #FFFFFF |
API Overview
- log(input, color?): Prints directly to your terminal. Accepts a string or a nested array.
- format(input, color?): Returns the raw ANSI-coded string for custom processing.
License
GPL-3.0 License. See LICENSE for details.
