just-color-it
Version:
A lightweight, zero-dependency Node.js library for adding colors to your terminal output. Supports both CommonJS and ES modules.
22 lines (19 loc) • 482 B
JavaScript
const wrap = (color_code) => (input_text) =>
`\x1b[${color_code}m${input_text}\x1b[0m`;
// TEXT COLORS
const red = wrap(31);
const danger = red; // Alias for red
const green = wrap(32);
const success = green; // Alias for green
const yellow = wrap(33);
const warn = yellow; // Alias for yellow
// Exporting the color functions
module.exports = {
red,
green,
yellow,
danger,
success,
warn,
wrap,
}; // Default export for CommonJS compatibility