just-color-it
Version:
A lightweight, zero-dependency Node.js library for adding colors to your terminal output. Supports both CommonJS and ES modules.
13 lines (10 loc) • 396 B
JavaScript
const wrap = (color_code) => (input_text) =>
`\x1b[${color_code}m${input_text}\x1b[0m`;
export const red = wrap(31);
export const danger = red; // Alias for red
export const green = wrap(32);
export const success = green; // Alias for green
export const yellow = wrap(33);
export const warn = yellow; // Alias for yellow
// Export wrap function for custom colors
export { wrap };