UNPKG

namastejs

Version:

A spiritual greeting from your JavaScript code. Because every function deserves a 'Namaste 🙏'

71 lines (62 loc) 2.97 kB
const RESET = "\x1b[0m"; const wrap = (code, text) => `${code}${text}${RESET}`; const style = { reset: RESET, /* ─────────────── TEXT STYLES ─────────────── */ bold: (t) => wrap("\x1b[1m", t), dim: (t) => wrap("\x1b[2m", t), italic: (t) => wrap("\x1b[3m", t), underline: (t) => wrap("\x1b[4m", t), doubleUnderline: (t) => wrap("\x1b[21m", t), blink: (t) => wrap("\x1b[5m", t), inverse: (t) => wrap("\x1b[7m", t), hidden: (t) => wrap("\x1b[8m", t), strikethrough: (t) => wrap("\x1b[9m", t), /* ─────────────── STANDARD COLORS ─────────────── */ black: (t) => wrap("\x1b[30m", t), red: (t) => wrap("\x1b[31m", t), green: (t) => wrap("\x1b[32m", t), yellow: (t) => wrap("\x1b[33m", t), blue: (t) => wrap("\x1b[34m", t), magenta: (t) => wrap("\x1b[35m", t), cyan: (t) => wrap("\x1b[36m", t), white: (t) => wrap("\x1b[37m", t), /* ─────────────── BRIGHT COLORS ─────────────── */ gray: (t) => wrap("\x1b[90m", t), brightRed: (t) => wrap("\x1b[91m", t), brightGreen: (t) => wrap("\x1b[92m", t), brightYellow: (t) => wrap("\x1b[93m", t), brightBlue: (t) => wrap("\x1b[94m", t), brightMagenta: (t) => wrap("\x1b[95m", t), // pink brightCyan: (t) => wrap("\x1b[96m", t), brightWhite: (t) => wrap("\x1b[97m", t), /* ─────────────── POPULAR 256-COLOR SHADES ─────────────── */ pink: (t) => wrap("\x1b[38;5;213m", t), hotPink: (t) => wrap("\x1b[38;5;205m", t), rose: (t) => wrap("\x1b[38;5;212m", t), orange: (t) => wrap("\x1b[38;5;208m", t), gold: (t) => wrap("\x1b[38;5;220m", t), lime: (t) => wrap("\x1b[38;5;118m", t), teal: (t) => wrap("\x1b[38;5;37m", t), skyBlue: (t) => wrap("\x1b[38;5;117m", t), purple: (t) => wrap("\x1b[38;5;135m", t), /* ─────────────── BACKGROUND COLORS ─────────────── */ bgBlack: (t) => wrap("\x1b[40m", t), bgRed: (t) => wrap("\x1b[41m", t), bgGreen: (t) => wrap("\x1b[42m", t), bgYellow: (t) => wrap("\x1b[43m", t), bgBlue: (t) => wrap("\x1b[44m", t), bgMagenta: (t) => wrap("\x1b[45m", t), bgCyan: (t) => wrap("\x1b[46m", t), bgWhite: (t) => wrap("\x1b[47m", t), /* ─────────────── BRIGHT BACKGROUNDS ─────────────── */ bgGray: (t) => wrap("\x1b[100m", t), bgBrightRed: (t) => wrap("\x1b[101m", t), bgBrightGreen: (t) => wrap("\x1b[102m", t), bgBrightYellow: (t) => wrap("\x1b[103m", t), bgBrightBlue: (t) => wrap("\x1b[104m", t), bgBrightMagenta: (t) => wrap("\x1b[105m", t), bgBrightCyan: (t) => wrap("\x1b[106m", t), bgBrightWhite: (t) => wrap("\x1b[107m", t), }; module.exports = style;