summaryrefslogtreecommitdiff
path: root/node_modules/kleur/colors.js
diff options
context:
space:
mode:
authorShipwreckt <me@shipwreckt.co.uk>2025-10-31 20:02:14 +0000
committerShipwreckt <me@shipwreckt.co.uk>2025-10-31 20:02:14 +0000
commit7a52ddeba2a68388b544f529d2d92104420f77b0 (patch)
tree15ddd47457a2cb4a96060747437d36474e4f6b4e /node_modules/kleur/colors.js
parent53d6ae2b5568437afa5e4995580a3fb679b7b91b (diff)
Changed from static to 11ty!
Diffstat (limited to 'node_modules/kleur/colors.js')
-rw-r--r--node_modules/kleur/colors.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/node_modules/kleur/colors.js b/node_modules/kleur/colors.js
new file mode 100644
index 0000000..89fb012
--- /dev/null
+++ b/node_modules/kleur/colors.js
@@ -0,0 +1,53 @@
+let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true;
+if (typeof process !== 'undefined') {
+ ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
+ isTTY = process.stdout && process.stdout.isTTY;
+}
+
+const $ = exports.$ = {
+ enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && (
+ FORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY
+ )
+}
+
+function init(x, y) {
+ let rgx = new RegExp(`\\x1b\\[${y}m`, 'g');
+ let open = `\x1b[${x}m`, close = `\x1b[${y}m`;
+
+ return function (txt) {
+ if (!$.enabled || txt == null) return txt;
+ return open + (!!~(''+txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
+ };
+}
+
+// modifiers
+exports.reset = init(0, 0);
+exports.bold = init(1, 22);
+exports.dim = init(2, 22);
+exports.italic = init(3, 23);
+exports.underline = init(4, 24);
+exports.inverse = init(7, 27);
+exports.hidden = init(8, 28);
+exports.strikethrough = init(9, 29);
+
+// colors
+exports.black = init(30, 39);
+exports.red = init(31, 39);
+exports.green = init(32, 39);
+exports.yellow = init(33, 39);
+exports.blue = init(34, 39);
+exports.magenta = init(35, 39);
+exports.cyan = init(36, 39);
+exports.white = init(37, 39);
+exports.gray = init(90, 39);
+exports.grey = init(90, 39);
+
+// background colors
+exports.bgBlack = init(40, 49);
+exports.bgRed = init(41, 49);
+exports.bgGreen = init(42, 49);
+exports.bgYellow = init(43, 49);
+exports.bgBlue = init(44, 49);
+exports.bgMagenta = init(45, 49);
+exports.bgCyan = init(46, 49);
+exports.bgWhite = init(47, 49);