micro-ansi
Version:
Easily use 4 bit ANSI colors in your HTML or terminal
61 lines (60 loc) • 2.4 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
default: () => index_default
});
module.exports = __toCommonJS(index_exports);
var ansi = {
black: (t) => `\x1B[30m${t}\x1B[0m`,
red: (t) => `\x1B[31m${t}\x1B[0m`,
green: (t) => `\x1B[32m${t}\x1B[0m`,
yellow: (t) => `\x1B[33m${t}\x1B[0m`,
blue: (t) => `\x1B[34m${t}\x1B[0m`,
magenta: (t) => `\x1B[35m${t}\x1B[0m`,
cyan: (t) => `\x1B[36m${t}\x1B[0m`,
white: (t) => `\x1B[37m${t}\x1B[0m`,
brightBlack: (t) => `\x1B[90m${t}\x1B[0m`,
brightRed: (t) => `\x1B[91m${t}\x1B[0m`,
brightGreen: (t) => `\x1B[92m${t}\x1B[0m`,
brightYellow: (t) => `\x1B[93m${t}\x1B[0m`,
brightBlue: (t) => `\x1B[94m${t}\x1B[0m`,
brightMagenta: (t) => `\x1B[95m${t}\x1B[0m`,
brightCyan: (t) => `\x1B[96m${t}\x1B[0m`,
brightWhite: (t) => `\x1B[97m${t}\x1B[0m`,
bgBlack: (t) => `\x1B[40m${t}\x1B[0m`,
bgRed: (t) => `\x1B[41m${t}\x1B[0m`,
bgGreen: (t) => `\x1B[42m${t}\x1B[0m`,
bgYellow: (t) => `\x1B[43m${t}\x1B[0m`,
bgBlue: (t) => `\x1B[44m${t}\x1B[0m`,
bgMagenta: (t) => `\x1B[45m${t}\x1B[0m`,
bgCyan: (t) => `\x1B[46m${t}\x1B[0m`,
bgWhite: (t) => `\x1B[47m${t}\x1B[0m`,
bgBrightBlack: (t) => `\x1B[100m${t}\x1B[0m`,
bgBrightRed: (t) => `\x1B[101m${t}\x1B[0m`,
bgBrightGreen: (t) => `\x1B[102m${t}\x1B[0m`,
bgBrightYellow: (t) => `\x1B[103m${t}\x1B[0m`,
bgBrightBlue: (t) => `\x1B[104m${t}\x1B[0m`,
bgBrightMagenta: (t) => `\x1B[105m${t}\x1B[0m`,
bgBrightCyan: (t) => `\x1B[106m${t}\x1B[0m`,
bgBrightWhite: (t) => `\x1B[107m${t}\x1B[0m`
};
var index_default = ansi;
//# sourceMappingURL=index.js.map