@oxog/pigment 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +406 -0
- package/dist/index-BE-MUtRO.d.cts +427 -0
- package/dist/index-BE-MUtRO.d.ts +427 -0
- package/dist/index.cjs +1884 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +245 -0
- package/dist/index.d.ts +245 -0
- package/dist/index.js +1802 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/index.cjs +1463 -0
- package/dist/plugins/index.cjs.map +1 -0
- package/dist/plugins/index.d.cts +3 -0
- package/dist/plugins/index.d.ts +3 -0
- package/dist/plugins/index.js +1426 -0
- package/dist/plugins/index.js.map +1 -0
- package/package.json +84 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1884 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oxog/pigment - Zero-dependency terminal styling
|
|
3
|
+
* MIT License - https://pigment.oxog.dev
|
|
4
|
+
*/
|
|
5
|
+
"use strict";
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
+
|
|
24
|
+
// src/index.ts
|
|
25
|
+
var index_exports = {};
|
|
26
|
+
__export(index_exports, {
|
|
27
|
+
BuilderPigment: () => BuilderPigment,
|
|
28
|
+
bgBlack: () => bgBlack,
|
|
29
|
+
bgBlackBright: () => bgBlackBright,
|
|
30
|
+
bgBlue: () => bgBlue,
|
|
31
|
+
bgBlueBright: () => bgBlueBright,
|
|
32
|
+
bgCyan: () => bgCyan,
|
|
33
|
+
bgCyanBright: () => bgCyanBright,
|
|
34
|
+
bgGray: () => bgGray,
|
|
35
|
+
bgGreen: () => bgGreen,
|
|
36
|
+
bgGreenBright: () => bgGreenBright,
|
|
37
|
+
bgGrey: () => bgGrey,
|
|
38
|
+
bgMagenta: () => bgMagenta,
|
|
39
|
+
bgMagentaBright: () => bgMagentaBright,
|
|
40
|
+
bgRed: () => bgRed,
|
|
41
|
+
bgRedBright: () => bgRedBright,
|
|
42
|
+
bgWhite: () => bgWhite,
|
|
43
|
+
bgWhiteBright: () => bgWhiteBright,
|
|
44
|
+
bgYellow: () => bgYellow,
|
|
45
|
+
bgYellowBright: () => bgYellowBright,
|
|
46
|
+
black: () => black,
|
|
47
|
+
blackBright: () => blackBright,
|
|
48
|
+
blue: () => blue,
|
|
49
|
+
blueBright: () => blueBright,
|
|
50
|
+
bold: () => bold,
|
|
51
|
+
compose: () => compose,
|
|
52
|
+
createKernel: () => import_plugin2.createKernel,
|
|
53
|
+
createPigment: () => createPigment,
|
|
54
|
+
cyan: () => cyan,
|
|
55
|
+
cyanBright: () => cyanBright,
|
|
56
|
+
default: () => index_default,
|
|
57
|
+
detectColorSupport: () => detectColorSupport,
|
|
58
|
+
detectPlatform: () => detectPlatform,
|
|
59
|
+
dim: () => dim,
|
|
60
|
+
gray: () => gray,
|
|
61
|
+
green: () => green,
|
|
62
|
+
greenBright: () => greenBright,
|
|
63
|
+
grey: () => grey,
|
|
64
|
+
hasTTY: () => hasTTY,
|
|
65
|
+
hexToRgb: () => hexToRgb,
|
|
66
|
+
hidden: () => hidden,
|
|
67
|
+
hslToRgb: () => hslToRgb,
|
|
68
|
+
inverse: () => inverse,
|
|
69
|
+
isBrowser: () => isBrowser,
|
|
70
|
+
isCI: () => isCI,
|
|
71
|
+
isNode: () => isNode,
|
|
72
|
+
isWindows: () => isWindows,
|
|
73
|
+
italic: () => italic,
|
|
74
|
+
magenta: () => magenta,
|
|
75
|
+
magentaBright: () => magentaBright,
|
|
76
|
+
pigment: () => pigment,
|
|
77
|
+
plugins: () => plugins_exports,
|
|
78
|
+
red: () => red,
|
|
79
|
+
redBright: () => redBright,
|
|
80
|
+
reset: () => reset,
|
|
81
|
+
rgbToAnsi256: () => rgbToAnsi256,
|
|
82
|
+
strikethrough: () => strikethrough,
|
|
83
|
+
supportsColor: () => supportsColor,
|
|
84
|
+
underline: () => underline,
|
|
85
|
+
validateHex: () => validateHex,
|
|
86
|
+
white: () => white,
|
|
87
|
+
whiteBright: () => whiteBright,
|
|
88
|
+
yellow: () => yellow,
|
|
89
|
+
yellowBright: () => yellowBright
|
|
90
|
+
});
|
|
91
|
+
module.exports = __toCommonJS(index_exports);
|
|
92
|
+
|
|
93
|
+
// src/core/factory.ts
|
|
94
|
+
var import_plugin = require("@oxog/plugin");
|
|
95
|
+
|
|
96
|
+
// src/constants.ts
|
|
97
|
+
var ANSI_MODIFIERS = {
|
|
98
|
+
bold: { open: "\x1B[1m", close: "\x1B[22m" },
|
|
99
|
+
dim: { open: "\x1B[2m", close: "\x1B[22m" },
|
|
100
|
+
italic: { open: "\x1B[3m", close: "\x1B[23m" },
|
|
101
|
+
underline: { open: "\x1B[4m", close: "\x1B[24m" },
|
|
102
|
+
strikethrough: { open: "\x1B[9m", close: "\x1B[29m" },
|
|
103
|
+
inverse: { open: "\x1B[7m", close: "\x1B[27m" },
|
|
104
|
+
hidden: { open: "\x1B[8m", close: "\x1B[28m" },
|
|
105
|
+
reset: { open: "\x1B[0m", close: "\x1B[0m" }
|
|
106
|
+
};
|
|
107
|
+
var ANSI_FOREGROUND_COLORS = {
|
|
108
|
+
black: 30,
|
|
109
|
+
red: 31,
|
|
110
|
+
green: 32,
|
|
111
|
+
yellow: 33,
|
|
112
|
+
blue: 34,
|
|
113
|
+
magenta: 35,
|
|
114
|
+
cyan: 36,
|
|
115
|
+
white: 37
|
|
116
|
+
};
|
|
117
|
+
var ANSI_FOREGROUND_BRIGHT_COLORS = {
|
|
118
|
+
blackBright: 90,
|
|
119
|
+
redBright: 91,
|
|
120
|
+
greenBright: 92,
|
|
121
|
+
yellowBright: 93,
|
|
122
|
+
blueBright: 94,
|
|
123
|
+
magentaBright: 95,
|
|
124
|
+
cyanBright: 96,
|
|
125
|
+
whiteBright: 97
|
|
126
|
+
};
|
|
127
|
+
var ANSI_BACKGROUND_COLORS = {
|
|
128
|
+
bgBlack: 40,
|
|
129
|
+
bgRed: 41,
|
|
130
|
+
bgGreen: 42,
|
|
131
|
+
bgYellow: 43,
|
|
132
|
+
bgBlue: 44,
|
|
133
|
+
bgMagenta: 45,
|
|
134
|
+
bgCyan: 46,
|
|
135
|
+
bgWhite: 47
|
|
136
|
+
};
|
|
137
|
+
var ANSI_BACKGROUND_BRIGHT_COLORS = {
|
|
138
|
+
bgBlackBright: 100,
|
|
139
|
+
bgRedBright: 101,
|
|
140
|
+
bgGreenBright: 102,
|
|
141
|
+
bgYellowBright: 103,
|
|
142
|
+
bgBlueBright: 104,
|
|
143
|
+
bgMagentaBright: 105,
|
|
144
|
+
bgCyanBright: 106,
|
|
145
|
+
bgWhiteBright: 107
|
|
146
|
+
};
|
|
147
|
+
var THEME_PRESETS = {
|
|
148
|
+
monokai: {
|
|
149
|
+
keyword: "#ff79c6",
|
|
150
|
+
string: "#f1fa8c",
|
|
151
|
+
number: "#bd93f9",
|
|
152
|
+
comment: "#6272a4",
|
|
153
|
+
error: "#ff5555",
|
|
154
|
+
success: "#50fa7b",
|
|
155
|
+
warning: "#ffb86c",
|
|
156
|
+
info: "#8be9fd"
|
|
157
|
+
},
|
|
158
|
+
dracula: {
|
|
159
|
+
keyword: "#ff79c6",
|
|
160
|
+
string: "#f1fa8c",
|
|
161
|
+
number: "#bd93f9",
|
|
162
|
+
comment: "#6272a4",
|
|
163
|
+
error: "#ff5555",
|
|
164
|
+
success: "#50fa7b",
|
|
165
|
+
warning: "#ffb86c",
|
|
166
|
+
info: "#8be9fd"
|
|
167
|
+
},
|
|
168
|
+
nord: {
|
|
169
|
+
keyword: "#81a1c1",
|
|
170
|
+
string: "#a3be8c",
|
|
171
|
+
number: "#b48ead",
|
|
172
|
+
comment: "#616e88",
|
|
173
|
+
error: "#bf616a",
|
|
174
|
+
success: "#a3be8c",
|
|
175
|
+
warning: "#ebcb8b",
|
|
176
|
+
info: "#88c0d0"
|
|
177
|
+
},
|
|
178
|
+
github: {
|
|
179
|
+
keyword: "#ff7b72",
|
|
180
|
+
string: "#a5d6ff",
|
|
181
|
+
number: "#79c0ff",
|
|
182
|
+
comment: "#8b949e",
|
|
183
|
+
error: "#f85149",
|
|
184
|
+
success: "#3fb950",
|
|
185
|
+
warning: "#d29922",
|
|
186
|
+
info: "#58a6ff"
|
|
187
|
+
},
|
|
188
|
+
vscode: {
|
|
189
|
+
keyword: "#569cd6",
|
|
190
|
+
string: "#ce9178",
|
|
191
|
+
number: "#b5cea8",
|
|
192
|
+
comment: "#6a9955",
|
|
193
|
+
error: "#f14c4c",
|
|
194
|
+
success: "#4ec9b0",
|
|
195
|
+
warning: "#dcdcaa",
|
|
196
|
+
info: "#9cdcfe"
|
|
197
|
+
},
|
|
198
|
+
"tokyo-night": {
|
|
199
|
+
keyword: "#bb9af7",
|
|
200
|
+
string: "#9ece6a",
|
|
201
|
+
number: "#ff9e64",
|
|
202
|
+
comment: "#565f89",
|
|
203
|
+
error: "#f7768e",
|
|
204
|
+
success: "#73daca",
|
|
205
|
+
warning: "#e0af68",
|
|
206
|
+
info: "#7dcfff"
|
|
207
|
+
},
|
|
208
|
+
catppuccin: {
|
|
209
|
+
keyword: "#cba6f7",
|
|
210
|
+
string: "#a6e3a1",
|
|
211
|
+
number: "#fab387",
|
|
212
|
+
comment: "#6c7086",
|
|
213
|
+
error: "#f38ba8",
|
|
214
|
+
success: "#a6e3a1",
|
|
215
|
+
warning: "#f9e2af",
|
|
216
|
+
info: "#89b4fa"
|
|
217
|
+
},
|
|
218
|
+
"one-dark": {
|
|
219
|
+
keyword: "#c678dd",
|
|
220
|
+
string: "#98c379",
|
|
221
|
+
number: "#d19a66",
|
|
222
|
+
comment: "#5c6370",
|
|
223
|
+
error: "#e06c75",
|
|
224
|
+
success: "#98c379",
|
|
225
|
+
warning: "#e5c07b",
|
|
226
|
+
info: "#61afef"
|
|
227
|
+
},
|
|
228
|
+
solarized: {
|
|
229
|
+
keyword: "#859900",
|
|
230
|
+
string: "#2aa198",
|
|
231
|
+
number: "#d33682",
|
|
232
|
+
comment: "#586e75",
|
|
233
|
+
error: "#dc322f",
|
|
234
|
+
success: "#859900",
|
|
235
|
+
warning: "#b58900",
|
|
236
|
+
info: "#268bd2"
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
var BOX_BORDERS = {
|
|
240
|
+
single: { tl: "\u250C", tr: "\u2510", bl: "\u2514", br: "\u2518", h: "\u2500", v: "\u2502" },
|
|
241
|
+
double: { tl: "\u2554", tr: "\u2557", bl: "\u255A", br: "\u255D", h: "\u2550", v: "\u2551" },
|
|
242
|
+
rounded: { tl: "\u256D", tr: "\u256E", bl: "\u2570", br: "\u256F", h: "\u2500", v: "\u2502" },
|
|
243
|
+
bold: { tl: "\u250F", tr: "\u2513", bl: "\u2517", br: "\u251B", h: "\u2501", v: "\u2503" },
|
|
244
|
+
classic: { tl: "+", tr: "+", bl: "+", br: "+", h: "-", v: "|" }
|
|
245
|
+
};
|
|
246
|
+
var MODIFIER_NAMES = [
|
|
247
|
+
"bold",
|
|
248
|
+
"dim",
|
|
249
|
+
"italic",
|
|
250
|
+
"underline",
|
|
251
|
+
"strikethrough",
|
|
252
|
+
"inverse",
|
|
253
|
+
"hidden",
|
|
254
|
+
"reset"
|
|
255
|
+
];
|
|
256
|
+
var COLOR_NAMES = [
|
|
257
|
+
"black",
|
|
258
|
+
"red",
|
|
259
|
+
"green",
|
|
260
|
+
"yellow",
|
|
261
|
+
"blue",
|
|
262
|
+
"magenta",
|
|
263
|
+
"cyan",
|
|
264
|
+
"white",
|
|
265
|
+
"blackBright",
|
|
266
|
+
"redBright",
|
|
267
|
+
"greenBright",
|
|
268
|
+
"yellowBright",
|
|
269
|
+
"blueBright",
|
|
270
|
+
"magentaBright",
|
|
271
|
+
"cyanBright",
|
|
272
|
+
"whiteBright",
|
|
273
|
+
"gray",
|
|
274
|
+
"grey"
|
|
275
|
+
];
|
|
276
|
+
var BACKGROUND_COLOR_NAMES = [
|
|
277
|
+
"bgBlack",
|
|
278
|
+
"bgRed",
|
|
279
|
+
"bgGreen",
|
|
280
|
+
"bgYellow",
|
|
281
|
+
"bgBlue",
|
|
282
|
+
"bgMagenta",
|
|
283
|
+
"bgCyan",
|
|
284
|
+
"bgWhite",
|
|
285
|
+
"bgBlackBright",
|
|
286
|
+
"bgRedBright",
|
|
287
|
+
"bgGreenBright",
|
|
288
|
+
"bgYellowBright",
|
|
289
|
+
"bgBlueBright",
|
|
290
|
+
"bgMagentaBright",
|
|
291
|
+
"bgCyanBright",
|
|
292
|
+
"bgWhiteBright",
|
|
293
|
+
"bgGray",
|
|
294
|
+
"bgGrey"
|
|
295
|
+
];
|
|
296
|
+
var EXTENDED_COLOR_METHODS = [
|
|
297
|
+
"ansi256",
|
|
298
|
+
"bgAnsi256",
|
|
299
|
+
"rgb",
|
|
300
|
+
"bgRgb",
|
|
301
|
+
"hex",
|
|
302
|
+
"bgHex",
|
|
303
|
+
"hsl",
|
|
304
|
+
"bgHsl"
|
|
305
|
+
];
|
|
306
|
+
|
|
307
|
+
// src/errors.ts
|
|
308
|
+
var PigmentError = class _PigmentError extends Error {
|
|
309
|
+
code;
|
|
310
|
+
constructor(message, code) {
|
|
311
|
+
super(message);
|
|
312
|
+
this.name = "PigmentError";
|
|
313
|
+
this.code = code;
|
|
314
|
+
Error.captureStackTrace(this, _PigmentError);
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
var ColorError = class extends PigmentError {
|
|
318
|
+
constructor(message) {
|
|
319
|
+
super(message, "COLOR_ERROR");
|
|
320
|
+
this.name = "ColorError";
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
var StyleError = class extends PigmentError {
|
|
324
|
+
constructor(message) {
|
|
325
|
+
super(message, "STYLE_ERROR");
|
|
326
|
+
this.name = "StyleError";
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
// src/core/ansi.ts
|
|
331
|
+
function generateModifierCode(name) {
|
|
332
|
+
const modifier = ANSI_MODIFIERS[name];
|
|
333
|
+
if (!modifier) {
|
|
334
|
+
throw new StyleError(`Unknown modifier: ${name}`);
|
|
335
|
+
}
|
|
336
|
+
return {
|
|
337
|
+
name,
|
|
338
|
+
code: -1,
|
|
339
|
+
open: modifier.open,
|
|
340
|
+
close: modifier.close,
|
|
341
|
+
type: "modifier"
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
function generateColorCode(name, background = false) {
|
|
345
|
+
let normalizedName = name;
|
|
346
|
+
const lowerName = name.toLowerCase();
|
|
347
|
+
if (lowerName === "gray" || lowerName === "grey") {
|
|
348
|
+
normalizedName = "blackBright";
|
|
349
|
+
} else if (lowerName === "bggray" || lowerName === "bggrey") {
|
|
350
|
+
normalizedName = "bgBlackBright";
|
|
351
|
+
}
|
|
352
|
+
const foregroundColors = { ...ANSI_FOREGROUND_COLORS, ...ANSI_FOREGROUND_BRIGHT_COLORS };
|
|
353
|
+
const backgroundColors = { ...ANSI_BACKGROUND_COLORS, ...ANSI_BACKGROUND_BRIGHT_COLORS };
|
|
354
|
+
let lookupName = normalizedName;
|
|
355
|
+
if (background && !normalizedName.startsWith("bg")) {
|
|
356
|
+
lookupName = "bg" + normalizedName.charAt(0).toUpperCase() + normalizedName.slice(1);
|
|
357
|
+
}
|
|
358
|
+
const allColors = background ? backgroundColors : foregroundColors;
|
|
359
|
+
const code = allColors[lookupName];
|
|
360
|
+
if (code === void 0) {
|
|
361
|
+
throw new StyleError(`Unknown color: ${name}`);
|
|
362
|
+
}
|
|
363
|
+
const closeCode = background ? 49 : 39;
|
|
364
|
+
return {
|
|
365
|
+
name,
|
|
366
|
+
code,
|
|
367
|
+
open: `\x1B[${code}m`,
|
|
368
|
+
close: `\x1B[${closeCode}m`,
|
|
369
|
+
type: "color",
|
|
370
|
+
background
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
function generateAnsi256Code(code, background = false) {
|
|
374
|
+
if (code < 0 || code > 255) {
|
|
375
|
+
throw new StyleError(`ANSI 256 code must be between 0 and 255, got ${code}`);
|
|
376
|
+
}
|
|
377
|
+
const prefix = background ? 48 : 38;
|
|
378
|
+
const closeCode = background ? 49 : 39;
|
|
379
|
+
return {
|
|
380
|
+
name: `ansi256(${code})`,
|
|
381
|
+
code,
|
|
382
|
+
open: `\x1B[${prefix};5;${code}m`,
|
|
383
|
+
close: `\x1B[${closeCode}m`,
|
|
384
|
+
type: "color",
|
|
385
|
+
background
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
function generateRgbCode(r, g, b, background = false) {
|
|
389
|
+
if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255) {
|
|
390
|
+
throw new StyleError(`RGB values must be between 0 and 255, got (${r}, ${g}, ${b})`);
|
|
391
|
+
}
|
|
392
|
+
const prefix = background ? 48 : 38;
|
|
393
|
+
const closeCode = background ? 49 : 39;
|
|
394
|
+
return {
|
|
395
|
+
name: `rgb(${r}, ${g}, ${b})`,
|
|
396
|
+
code: -1,
|
|
397
|
+
open: `\x1B[${prefix};2;${r};${g};${b}m`,
|
|
398
|
+
close: `\x1B[${closeCode}m`,
|
|
399
|
+
type: "color",
|
|
400
|
+
background
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// src/core/proxy.ts
|
|
405
|
+
var proxyCache = /* @__PURE__ */ new WeakMap();
|
|
406
|
+
function createProxyPigment(kernel, styles = []) {
|
|
407
|
+
const handler = {
|
|
408
|
+
get(target, prop) {
|
|
409
|
+
const ctx = kernel.getContext();
|
|
410
|
+
if (prop === "level") {
|
|
411
|
+
return ctx.level;
|
|
412
|
+
}
|
|
413
|
+
if (prop === "supportsColor") {
|
|
414
|
+
return ctx.colorSupport;
|
|
415
|
+
}
|
|
416
|
+
if (MODIFIER_NAMES.includes(prop)) {
|
|
417
|
+
const modifierStyle = generateModifierCode(prop);
|
|
418
|
+
return createProxyPigment(kernel, [...styles, modifierStyle]);
|
|
419
|
+
}
|
|
420
|
+
if (COLOR_NAMES.includes(prop) || BACKGROUND_COLOR_NAMES.includes(prop)) {
|
|
421
|
+
const background = prop.startsWith("bg");
|
|
422
|
+
const colorName = background ? prop.slice(2) : prop;
|
|
423
|
+
const colorStyle = generateColorCode(colorName, background);
|
|
424
|
+
return createProxyPigment(kernel, [...styles, colorStyle]);
|
|
425
|
+
}
|
|
426
|
+
if (EXTENDED_COLOR_METHODS.includes(prop)) {
|
|
427
|
+
if (prop === "ansi256" || prop === "bgAnsi256") {
|
|
428
|
+
return (code) => {
|
|
429
|
+
const background = prop === "bgAnsi256";
|
|
430
|
+
const ansi256Style = generateAnsi256Code(code, background);
|
|
431
|
+
return createProxyPigment(kernel, [...styles, ansi256Style]);
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
if (prop === "rgb" || prop === "bgRgb") {
|
|
435
|
+
return (r, g, b) => {
|
|
436
|
+
const background = prop === "bgRgb";
|
|
437
|
+
const rgbStyle = generateRgbCode(r, g, b, background);
|
|
438
|
+
return createProxyPigment(kernel, [...styles, rgbStyle]);
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
if (prop === "hex" || prop === "bgHex") {
|
|
442
|
+
return (color) => {
|
|
443
|
+
const background = prop === "bgHex";
|
|
444
|
+
const hexToRgb2 = ctx.utils?.hexToRgb;
|
|
445
|
+
if (!hexToRgb2) {
|
|
446
|
+
throw new Error("hexToRgb utility not available");
|
|
447
|
+
}
|
|
448
|
+
const { r, g, b } = hexToRgb2(color);
|
|
449
|
+
const rgbStyle = generateRgbCode(r, g, b, background);
|
|
450
|
+
return createProxyPigment(kernel, [...styles, rgbStyle]);
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
if (prop === "hsl" || prop === "bgHsl") {
|
|
454
|
+
return (h, s, l) => {
|
|
455
|
+
const background = prop === "bgHsl";
|
|
456
|
+
const hslToRgb2 = ctx.utils?.hslToRgb;
|
|
457
|
+
if (!hslToRgb2) {
|
|
458
|
+
throw new Error("hslToRgb utility not available");
|
|
459
|
+
}
|
|
460
|
+
const { r, g, b } = hslToRgb2(h, s, l);
|
|
461
|
+
const rgbStyle = generateRgbCode(r, g, b, background);
|
|
462
|
+
return createProxyPigment(kernel, [...styles, rgbStyle]);
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
if (prop === "visible") {
|
|
467
|
+
const colorSupport = ctx.colorSupport;
|
|
468
|
+
return (text) => colorSupport.level > 0 ? text : text;
|
|
469
|
+
}
|
|
470
|
+
return target[prop];
|
|
471
|
+
},
|
|
472
|
+
apply(_target, _thisArg, argArray) {
|
|
473
|
+
const text = String(argArray[0] ?? "");
|
|
474
|
+
return applyStyles(text, styles);
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
const pigment2 = new Proxy((() => ""), handler);
|
|
478
|
+
proxyCache.set(pigment2, pigment2);
|
|
479
|
+
return pigment2;
|
|
480
|
+
}
|
|
481
|
+
function applyStyles(text, styles) {
|
|
482
|
+
if (styles.length === 0) {
|
|
483
|
+
return text;
|
|
484
|
+
}
|
|
485
|
+
const open = styles.map((style) => style.open).join("");
|
|
486
|
+
const close = [...styles].reverse().map((style) => style.close).join("");
|
|
487
|
+
return `${open}${text}${close}`;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// src/utils/hex-to-rgb.ts
|
|
491
|
+
function hexToRgb(hex) {
|
|
492
|
+
const hexString = hex.trim().replace(/^#/, "");
|
|
493
|
+
if (hexString.length === 3) {
|
|
494
|
+
const expanded = hexString.split("").map((c) => c + c).join("");
|
|
495
|
+
return parseExpandedHex(expanded);
|
|
496
|
+
}
|
|
497
|
+
if (hexString.length === 6) {
|
|
498
|
+
return parseExpandedHex(hexString);
|
|
499
|
+
}
|
|
500
|
+
throw new ColorError(`Invalid HEX color format: ${hex}. Expected #RRGGBB or #RGB`);
|
|
501
|
+
}
|
|
502
|
+
function parseExpandedHex(hex) {
|
|
503
|
+
if (!/^[0-9a-fA-F]{6}$/.test(hex)) {
|
|
504
|
+
throw new ColorError(`Invalid HEX color: ${hex}`);
|
|
505
|
+
}
|
|
506
|
+
const r = parseInt(hex.slice(0, 2), 16);
|
|
507
|
+
const g = parseInt(hex.slice(2, 4), 16);
|
|
508
|
+
const b = parseInt(hex.slice(4, 6), 16);
|
|
509
|
+
return { r, g, b };
|
|
510
|
+
}
|
|
511
|
+
function validateHex(hex) {
|
|
512
|
+
try {
|
|
513
|
+
hexToRgb(hex);
|
|
514
|
+
return true;
|
|
515
|
+
} catch {
|
|
516
|
+
return false;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
// src/utils/hsl-to-rgb.ts
|
|
521
|
+
function hslToRgb(h, s, l) {
|
|
522
|
+
const hNormalized = h / 360;
|
|
523
|
+
const sNormalized = s / 100;
|
|
524
|
+
const lNormalized = l / 100;
|
|
525
|
+
let r;
|
|
526
|
+
let g;
|
|
527
|
+
let b;
|
|
528
|
+
if (sNormalized === 0) {
|
|
529
|
+
r = g = b = lNormalized;
|
|
530
|
+
} else {
|
|
531
|
+
const hue2rgb = (p2, q2, t) => {
|
|
532
|
+
if (t < 0) t += 1;
|
|
533
|
+
if (t > 1) t -= 1;
|
|
534
|
+
if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t;
|
|
535
|
+
if (t < 1 / 2) return q2;
|
|
536
|
+
if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6;
|
|
537
|
+
return p2;
|
|
538
|
+
};
|
|
539
|
+
const q = lNormalized < 0.5 ? lNormalized * (1 + sNormalized) : lNormalized + sNormalized - lNormalized * sNormalized;
|
|
540
|
+
const p = 2 * lNormalized - q;
|
|
541
|
+
r = hue2rgb(p, q, hNormalized + 1 / 3);
|
|
542
|
+
g = hue2rgb(p, q, hNormalized);
|
|
543
|
+
b = hue2rgb(p, q, hNormalized - 1 / 3);
|
|
544
|
+
}
|
|
545
|
+
return {
|
|
546
|
+
r: Math.round(Math.max(0, Math.min(255, r * 255))),
|
|
547
|
+
g: Math.round(Math.max(0, Math.min(255, g * 255))),
|
|
548
|
+
b: Math.round(Math.max(0, Math.min(255, b * 255)))
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
// src/core/builder.ts
|
|
553
|
+
var BuilderPigment = class {
|
|
554
|
+
styles = [];
|
|
555
|
+
constructor(_kernel) {
|
|
556
|
+
}
|
|
557
|
+
bold() {
|
|
558
|
+
this.styles.push(generateModifierCode("bold"));
|
|
559
|
+
return this;
|
|
560
|
+
}
|
|
561
|
+
dim() {
|
|
562
|
+
this.styles.push(generateModifierCode("dim"));
|
|
563
|
+
return this;
|
|
564
|
+
}
|
|
565
|
+
italic() {
|
|
566
|
+
this.styles.push(generateModifierCode("italic"));
|
|
567
|
+
return this;
|
|
568
|
+
}
|
|
569
|
+
underline() {
|
|
570
|
+
this.styles.push(generateModifierCode("underline"));
|
|
571
|
+
return this;
|
|
572
|
+
}
|
|
573
|
+
strikethrough() {
|
|
574
|
+
this.styles.push(generateModifierCode("strikethrough"));
|
|
575
|
+
return this;
|
|
576
|
+
}
|
|
577
|
+
inverse() {
|
|
578
|
+
this.styles.push(generateModifierCode("inverse"));
|
|
579
|
+
return this;
|
|
580
|
+
}
|
|
581
|
+
hidden() {
|
|
582
|
+
this.styles.push(generateModifierCode("hidden"));
|
|
583
|
+
return this;
|
|
584
|
+
}
|
|
585
|
+
reset() {
|
|
586
|
+
this.styles.push(generateModifierCode("reset"));
|
|
587
|
+
return this;
|
|
588
|
+
}
|
|
589
|
+
black() {
|
|
590
|
+
this.styles.push(generateColorCode("black", false));
|
|
591
|
+
return this;
|
|
592
|
+
}
|
|
593
|
+
red() {
|
|
594
|
+
this.styles.push(generateColorCode("red", false));
|
|
595
|
+
return this;
|
|
596
|
+
}
|
|
597
|
+
green() {
|
|
598
|
+
this.styles.push(generateColorCode("green", false));
|
|
599
|
+
return this;
|
|
600
|
+
}
|
|
601
|
+
yellow() {
|
|
602
|
+
this.styles.push(generateColorCode("yellow", false));
|
|
603
|
+
return this;
|
|
604
|
+
}
|
|
605
|
+
blue() {
|
|
606
|
+
this.styles.push(generateColorCode("blue", false));
|
|
607
|
+
return this;
|
|
608
|
+
}
|
|
609
|
+
magenta() {
|
|
610
|
+
this.styles.push(generateColorCode("magenta", false));
|
|
611
|
+
return this;
|
|
612
|
+
}
|
|
613
|
+
cyan() {
|
|
614
|
+
this.styles.push(generateColorCode("cyan", false));
|
|
615
|
+
return this;
|
|
616
|
+
}
|
|
617
|
+
white() {
|
|
618
|
+
this.styles.push(generateColorCode("white", false));
|
|
619
|
+
return this;
|
|
620
|
+
}
|
|
621
|
+
blackBright() {
|
|
622
|
+
this.styles.push(generateColorCode("blackBright", false));
|
|
623
|
+
return this;
|
|
624
|
+
}
|
|
625
|
+
redBright() {
|
|
626
|
+
this.styles.push(generateColorCode("redBright", false));
|
|
627
|
+
return this;
|
|
628
|
+
}
|
|
629
|
+
greenBright() {
|
|
630
|
+
this.styles.push(generateColorCode("greenBright", false));
|
|
631
|
+
return this;
|
|
632
|
+
}
|
|
633
|
+
yellowBright() {
|
|
634
|
+
this.styles.push(generateColorCode("yellowBright", false));
|
|
635
|
+
return this;
|
|
636
|
+
}
|
|
637
|
+
blueBright() {
|
|
638
|
+
this.styles.push(generateColorCode("blueBright", false));
|
|
639
|
+
return this;
|
|
640
|
+
}
|
|
641
|
+
magentaBright() {
|
|
642
|
+
this.styles.push(generateColorCode("magentaBright", false));
|
|
643
|
+
return this;
|
|
644
|
+
}
|
|
645
|
+
cyanBright() {
|
|
646
|
+
this.styles.push(generateColorCode("cyanBright", false));
|
|
647
|
+
return this;
|
|
648
|
+
}
|
|
649
|
+
whiteBright() {
|
|
650
|
+
this.styles.push(generateColorCode("whiteBright", false));
|
|
651
|
+
return this;
|
|
652
|
+
}
|
|
653
|
+
gray() {
|
|
654
|
+
this.styles.push(generateColorCode("gray", false));
|
|
655
|
+
return this;
|
|
656
|
+
}
|
|
657
|
+
grey() {
|
|
658
|
+
this.styles.push(generateColorCode("grey", false));
|
|
659
|
+
return this;
|
|
660
|
+
}
|
|
661
|
+
bgBlack() {
|
|
662
|
+
this.styles.push(generateColorCode("black", true));
|
|
663
|
+
return this;
|
|
664
|
+
}
|
|
665
|
+
bgRed() {
|
|
666
|
+
this.styles.push(generateColorCode("red", true));
|
|
667
|
+
return this;
|
|
668
|
+
}
|
|
669
|
+
bgGreen() {
|
|
670
|
+
this.styles.push(generateColorCode("green", true));
|
|
671
|
+
return this;
|
|
672
|
+
}
|
|
673
|
+
bgYellow() {
|
|
674
|
+
this.styles.push(generateColorCode("yellow", true));
|
|
675
|
+
return this;
|
|
676
|
+
}
|
|
677
|
+
bgBlue() {
|
|
678
|
+
this.styles.push(generateColorCode("blue", true));
|
|
679
|
+
return this;
|
|
680
|
+
}
|
|
681
|
+
bgMagenta() {
|
|
682
|
+
this.styles.push(generateColorCode("magenta", true));
|
|
683
|
+
return this;
|
|
684
|
+
}
|
|
685
|
+
bgCyan() {
|
|
686
|
+
this.styles.push(generateColorCode("cyan", true));
|
|
687
|
+
return this;
|
|
688
|
+
}
|
|
689
|
+
bgWhite() {
|
|
690
|
+
this.styles.push(generateColorCode("white", true));
|
|
691
|
+
return this;
|
|
692
|
+
}
|
|
693
|
+
bgBlackBright() {
|
|
694
|
+
this.styles.push(generateColorCode("blackBright", true));
|
|
695
|
+
return this;
|
|
696
|
+
}
|
|
697
|
+
bgRedBright() {
|
|
698
|
+
this.styles.push(generateColorCode("redBright", true));
|
|
699
|
+
return this;
|
|
700
|
+
}
|
|
701
|
+
bgGreenBright() {
|
|
702
|
+
this.styles.push(generateColorCode("greenBright", true));
|
|
703
|
+
return this;
|
|
704
|
+
}
|
|
705
|
+
bgYellowBright() {
|
|
706
|
+
this.styles.push(generateColorCode("yellowBright", true));
|
|
707
|
+
return this;
|
|
708
|
+
}
|
|
709
|
+
bgBlueBright() {
|
|
710
|
+
this.styles.push(generateColorCode("blueBright", true));
|
|
711
|
+
return this;
|
|
712
|
+
}
|
|
713
|
+
bgMagentaBright() {
|
|
714
|
+
this.styles.push(generateColorCode("magentaBright", true));
|
|
715
|
+
return this;
|
|
716
|
+
}
|
|
717
|
+
bgCyanBright() {
|
|
718
|
+
this.styles.push(generateColorCode("cyanBright", true));
|
|
719
|
+
return this;
|
|
720
|
+
}
|
|
721
|
+
bgWhiteBright() {
|
|
722
|
+
this.styles.push(generateColorCode("whiteBright", true));
|
|
723
|
+
return this;
|
|
724
|
+
}
|
|
725
|
+
bgGray() {
|
|
726
|
+
this.styles.push(generateColorCode("gray", true));
|
|
727
|
+
return this;
|
|
728
|
+
}
|
|
729
|
+
bgGrey() {
|
|
730
|
+
this.styles.push(generateColorCode("grey", true));
|
|
731
|
+
return this;
|
|
732
|
+
}
|
|
733
|
+
ansi256(code) {
|
|
734
|
+
this.styles.push(generateAnsi256Code(code, false));
|
|
735
|
+
return this;
|
|
736
|
+
}
|
|
737
|
+
bgAnsi256(code) {
|
|
738
|
+
this.styles.push(generateAnsi256Code(code, true));
|
|
739
|
+
return this;
|
|
740
|
+
}
|
|
741
|
+
rgb(r, g, b) {
|
|
742
|
+
this.styles.push(generateRgbCode(r, g, b, false));
|
|
743
|
+
return this;
|
|
744
|
+
}
|
|
745
|
+
bgRgb(r, g, b) {
|
|
746
|
+
this.styles.push(generateRgbCode(r, g, b, true));
|
|
747
|
+
return this;
|
|
748
|
+
}
|
|
749
|
+
hex(color) {
|
|
750
|
+
const rgb = hexToRgb(color);
|
|
751
|
+
if (rgb) {
|
|
752
|
+
const { r, g, b } = rgb;
|
|
753
|
+
this.styles.push(generateRgbCode(r, g, b, false));
|
|
754
|
+
}
|
|
755
|
+
return this;
|
|
756
|
+
}
|
|
757
|
+
bgHex(color) {
|
|
758
|
+
const rgb = hexToRgb(color);
|
|
759
|
+
if (rgb) {
|
|
760
|
+
const { r, g, b } = rgb;
|
|
761
|
+
this.styles.push(generateRgbCode(r, g, b, true));
|
|
762
|
+
}
|
|
763
|
+
return this;
|
|
764
|
+
}
|
|
765
|
+
hsl(h, s, l) {
|
|
766
|
+
const { r, g, b } = hslToRgb(h, s, l);
|
|
767
|
+
this.styles.push(generateRgbCode(r, g, b, false));
|
|
768
|
+
return this;
|
|
769
|
+
}
|
|
770
|
+
bgHsl(h, s, l) {
|
|
771
|
+
const { r, g, b } = hslToRgb(h, s, l);
|
|
772
|
+
this.styles.push(generateRgbCode(r, g, b, true));
|
|
773
|
+
return this;
|
|
774
|
+
}
|
|
775
|
+
paint(text) {
|
|
776
|
+
if (this.styles.length === 0) {
|
|
777
|
+
return text;
|
|
778
|
+
}
|
|
779
|
+
const open = this.styles.map((style) => style.open).join("");
|
|
780
|
+
const close = [...this.styles].reverse().map((style) => style.close).join("");
|
|
781
|
+
return `${open}${text}${close}`;
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
// src/utils/platform.ts
|
|
786
|
+
var cachedPlatform;
|
|
787
|
+
function detectPlatform() {
|
|
788
|
+
if (cachedPlatform) {
|
|
789
|
+
return cachedPlatform;
|
|
790
|
+
}
|
|
791
|
+
const isNode2 = typeof process !== "undefined" && process.versions?.node !== void 0;
|
|
792
|
+
const isBrowser2 = typeof window !== "undefined" && typeof document !== "undefined";
|
|
793
|
+
const isWindows2 = isNode2 && process.platform === "win32";
|
|
794
|
+
const isCI2 = isNode2 && (process.env.CI === "true" || process.env.CONTINUOUS_INTEGRATION === "true");
|
|
795
|
+
const hasTTY2 = isNode2 && process.stdout?.isTTY === true;
|
|
796
|
+
cachedPlatform = { isNode: isNode2, isBrowser: isBrowser2, isWindows: isWindows2, isCI: isCI2, hasTTY: hasTTY2 };
|
|
797
|
+
return cachedPlatform;
|
|
798
|
+
}
|
|
799
|
+
function isNode() {
|
|
800
|
+
return detectPlatform().isNode;
|
|
801
|
+
}
|
|
802
|
+
function isBrowser() {
|
|
803
|
+
return detectPlatform().isBrowser;
|
|
804
|
+
}
|
|
805
|
+
function isWindows() {
|
|
806
|
+
return detectPlatform().isWindows;
|
|
807
|
+
}
|
|
808
|
+
function isCI() {
|
|
809
|
+
return detectPlatform().isCI;
|
|
810
|
+
}
|
|
811
|
+
function hasTTY() {
|
|
812
|
+
return detectPlatform().hasTTY;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
// src/utils/color-support.ts
|
|
816
|
+
var cachedColorSupport;
|
|
817
|
+
function detectColorSupport(overrideLevel) {
|
|
818
|
+
if (overrideLevel !== void 0) {
|
|
819
|
+
const level = overrideLevel;
|
|
820
|
+
return {
|
|
821
|
+
level,
|
|
822
|
+
hasBasic: level >= 1,
|
|
823
|
+
has256: level >= 2,
|
|
824
|
+
has16m: level >= 3
|
|
825
|
+
};
|
|
826
|
+
}
|
|
827
|
+
if (cachedColorSupport) {
|
|
828
|
+
return cachedColorSupport;
|
|
829
|
+
}
|
|
830
|
+
const platform = detectPlatform();
|
|
831
|
+
if (platform.isBrowser) {
|
|
832
|
+
cachedColorSupport = {
|
|
833
|
+
level: 3,
|
|
834
|
+
hasBasic: true,
|
|
835
|
+
has256: true,
|
|
836
|
+
has16m: true
|
|
837
|
+
};
|
|
838
|
+
return cachedColorSupport;
|
|
839
|
+
}
|
|
840
|
+
if (!platform.isNode) {
|
|
841
|
+
cachedColorSupport = {
|
|
842
|
+
level: 0,
|
|
843
|
+
hasBasic: false,
|
|
844
|
+
has256: false,
|
|
845
|
+
has16m: false
|
|
846
|
+
};
|
|
847
|
+
return cachedColorSupport;
|
|
848
|
+
}
|
|
849
|
+
if (process.env.NO_COLOR) {
|
|
850
|
+
cachedColorSupport = {
|
|
851
|
+
level: 0,
|
|
852
|
+
hasBasic: false,
|
|
853
|
+
has256: false,
|
|
854
|
+
has16m: false
|
|
855
|
+
};
|
|
856
|
+
return cachedColorSupport;
|
|
857
|
+
}
|
|
858
|
+
if (process.env.FORCE_COLOR) {
|
|
859
|
+
const level = parseInt(process.env.FORCE_COLOR, 10);
|
|
860
|
+
const clampedLevel = Math.max(0, Math.min(3, level));
|
|
861
|
+
cachedColorSupport = {
|
|
862
|
+
level: clampedLevel,
|
|
863
|
+
hasBasic: clampedLevel >= 1,
|
|
864
|
+
has256: clampedLevel >= 2,
|
|
865
|
+
has16m: clampedLevel >= 3
|
|
866
|
+
};
|
|
867
|
+
return cachedColorSupport;
|
|
868
|
+
}
|
|
869
|
+
if (!hasTTY() && !process.env.CI) {
|
|
870
|
+
cachedColorSupport = {
|
|
871
|
+
level: 0,
|
|
872
|
+
hasBasic: false,
|
|
873
|
+
has256: false,
|
|
874
|
+
has16m: false
|
|
875
|
+
};
|
|
876
|
+
return cachedColorSupport;
|
|
877
|
+
}
|
|
878
|
+
const term = process.env.TERM ?? "";
|
|
879
|
+
if (term.includes("truecolor") || term.includes("24bit")) {
|
|
880
|
+
cachedColorSupport = {
|
|
881
|
+
level: 3,
|
|
882
|
+
hasBasic: true,
|
|
883
|
+
has256: true,
|
|
884
|
+
has16m: true
|
|
885
|
+
};
|
|
886
|
+
return cachedColorSupport;
|
|
887
|
+
}
|
|
888
|
+
if (term.includes("256color")) {
|
|
889
|
+
cachedColorSupport = {
|
|
890
|
+
level: 2,
|
|
891
|
+
hasBasic: true,
|
|
892
|
+
has256: true,
|
|
893
|
+
has16m: false
|
|
894
|
+
};
|
|
895
|
+
return cachedColorSupport;
|
|
896
|
+
}
|
|
897
|
+
if (process.env.CI) {
|
|
898
|
+
cachedColorSupport = {
|
|
899
|
+
level: 1,
|
|
900
|
+
hasBasic: true,
|
|
901
|
+
has256: false,
|
|
902
|
+
has16m: false
|
|
903
|
+
};
|
|
904
|
+
return cachedColorSupport;
|
|
905
|
+
}
|
|
906
|
+
cachedColorSupport = {
|
|
907
|
+
level: 1,
|
|
908
|
+
hasBasic: true,
|
|
909
|
+
has256: false,
|
|
910
|
+
has16m: false
|
|
911
|
+
};
|
|
912
|
+
return cachedColorSupport;
|
|
913
|
+
}
|
|
914
|
+
function supportsColor() {
|
|
915
|
+
return detectColorSupport();
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
// src/utils/rgb-to-ansi256.ts
|
|
919
|
+
function rgbToAnsi256(r, g, b) {
|
|
920
|
+
const clampedR = Math.max(0, Math.min(255, r));
|
|
921
|
+
const clampedG = Math.max(0, Math.min(255, g));
|
|
922
|
+
const clampedB = Math.max(0, Math.min(255, b));
|
|
923
|
+
if (clampedR === clampedG && clampedG === clampedB) {
|
|
924
|
+
if (clampedR < 8) {
|
|
925
|
+
return 16;
|
|
926
|
+
}
|
|
927
|
+
if (clampedR > 248) {
|
|
928
|
+
return 231;
|
|
929
|
+
}
|
|
930
|
+
return Math.round((clampedR - 8) / 247 * 24) + 232;
|
|
931
|
+
}
|
|
932
|
+
return Math.round(clampedR / 51) * 36 + Math.round(clampedG / 51) * 6 + Math.round(clampedB / 51) + 16;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
// src/plugins/core/base-colors.ts
|
|
936
|
+
function baseColorsPlugin() {
|
|
937
|
+
return {
|
|
938
|
+
name: "base-colors",
|
|
939
|
+
version: "1.0.0",
|
|
940
|
+
install(kernel) {
|
|
941
|
+
const k = kernel;
|
|
942
|
+
const foregroundColors = { ...ANSI_FOREGROUND_COLORS, ...ANSI_FOREGROUND_BRIGHT_COLORS };
|
|
943
|
+
const backgroundColors = { ...ANSI_BACKGROUND_COLORS, ...ANSI_BACKGROUND_BRIGHT_COLORS };
|
|
944
|
+
k.updateContext({
|
|
945
|
+
colors: {
|
|
946
|
+
foreground: foregroundColors,
|
|
947
|
+
background: backgroundColors,
|
|
948
|
+
all: { ...foregroundColors, ...backgroundColors }
|
|
949
|
+
}
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
// src/plugins/core/modifiers.ts
|
|
956
|
+
function modifiersPlugin() {
|
|
957
|
+
return {
|
|
958
|
+
name: "modifiers",
|
|
959
|
+
version: "1.0.0",
|
|
960
|
+
install(kernel) {
|
|
961
|
+
const k = kernel;
|
|
962
|
+
k.updateContext({
|
|
963
|
+
modifiers: ANSI_MODIFIERS
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
// src/plugins/core/ansi256.ts
|
|
970
|
+
function ansi256Plugin() {
|
|
971
|
+
return {
|
|
972
|
+
name: "ansi256",
|
|
973
|
+
version: "1.0.0",
|
|
974
|
+
install(kernel) {
|
|
975
|
+
const k = kernel;
|
|
976
|
+
const ctx = k.getContext();
|
|
977
|
+
k.updateContext({
|
|
978
|
+
ansi256: {
|
|
979
|
+
enabled: true,
|
|
980
|
+
supports256: ctx.colorSupport?.has256 ?? false
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
k.on("color:ansi256", (data) => {
|
|
984
|
+
const { code, background } = data;
|
|
985
|
+
if (code < 0 || code > 255) {
|
|
986
|
+
k.emit("error", new Error(`ANSI 256 code must be between 0 and 255, got ${code}`));
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
const prefix = background ? 48 : 38;
|
|
990
|
+
const closeCode = background ? 49 : 39;
|
|
991
|
+
return {
|
|
992
|
+
name: `ansi256(${code})`,
|
|
993
|
+
code,
|
|
994
|
+
open: `\x1B[${prefix};5;${code}m`,
|
|
995
|
+
close: `\x1B[${closeCode}m`,
|
|
996
|
+
type: "color",
|
|
997
|
+
background
|
|
998
|
+
};
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
// src/plugins/core/true-color.ts
|
|
1005
|
+
function trueColorPlugin() {
|
|
1006
|
+
return {
|
|
1007
|
+
name: "true-color",
|
|
1008
|
+
version: "1.0.0",
|
|
1009
|
+
install(kernel) {
|
|
1010
|
+
const k = kernel;
|
|
1011
|
+
const ctx = k.getContext();
|
|
1012
|
+
const utils = ctx.utils;
|
|
1013
|
+
k.updateContext({
|
|
1014
|
+
trueColor: {
|
|
1015
|
+
enabled: true,
|
|
1016
|
+
supports16m: ctx.colorSupport?.has16m ?? false
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
k.on("color:rgb", (data) => {
|
|
1020
|
+
const { r, g, b, background } = data;
|
|
1021
|
+
if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255) {
|
|
1022
|
+
throw new ColorError(`RGB values must be between 0 and 255, got (${r}, ${g}, ${b})`);
|
|
1023
|
+
}
|
|
1024
|
+
const prefix = background ? 48 : 38;
|
|
1025
|
+
const closeCode = background ? 49 : 39;
|
|
1026
|
+
return {
|
|
1027
|
+
name: `rgb(${r}, ${g}, ${b})`,
|
|
1028
|
+
code: -1,
|
|
1029
|
+
open: `\x1B[${prefix};2;${r};${g};${b}m`,
|
|
1030
|
+
close: `\x1B[${closeCode}m`,
|
|
1031
|
+
type: "color",
|
|
1032
|
+
background
|
|
1033
|
+
};
|
|
1034
|
+
});
|
|
1035
|
+
k.on("color:hex", (data) => {
|
|
1036
|
+
const { hex, background } = data;
|
|
1037
|
+
if (!utils?.hexToRgb) {
|
|
1038
|
+
throw new Error("hexToRgb utility not available");
|
|
1039
|
+
}
|
|
1040
|
+
const rgb = utils.hexToRgb(hex);
|
|
1041
|
+
k.emit("color:rgb", { ...rgb, background });
|
|
1042
|
+
});
|
|
1043
|
+
k.on("color:hsl", (data) => {
|
|
1044
|
+
const { h, s, l, background } = data;
|
|
1045
|
+
if (!utils?.hslToRgb) {
|
|
1046
|
+
throw new Error("hslToRgb utility not available");
|
|
1047
|
+
}
|
|
1048
|
+
const rgb = utils.hslToRgb(h, s, l);
|
|
1049
|
+
k.emit("color:rgb", { ...rgb, background });
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
// src/plugins/core/nesting.ts
|
|
1056
|
+
function nestingPlugin() {
|
|
1057
|
+
return {
|
|
1058
|
+
name: "nesting",
|
|
1059
|
+
version: "1.0.0",
|
|
1060
|
+
install(kernel) {
|
|
1061
|
+
const k = kernel;
|
|
1062
|
+
k.updateContext({
|
|
1063
|
+
nesting: {
|
|
1064
|
+
enabled: true
|
|
1065
|
+
}
|
|
1066
|
+
});
|
|
1067
|
+
k.on("style:nest", (data) => {
|
|
1068
|
+
const { innerText, outerStyles } = data;
|
|
1069
|
+
const open = outerStyles.join("");
|
|
1070
|
+
const close = outerStyles.map(() => "\x1B[0m").join("");
|
|
1071
|
+
return `${open}${innerText}${close}`;
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
// src/plugins/core/environment.ts
|
|
1078
|
+
function environmentPlugin() {
|
|
1079
|
+
return {
|
|
1080
|
+
name: "environment",
|
|
1081
|
+
version: "1.0.0",
|
|
1082
|
+
install(kernel) {
|
|
1083
|
+
const k = kernel;
|
|
1084
|
+
const ci = isCI();
|
|
1085
|
+
const colorSupport = detectColorSupport();
|
|
1086
|
+
k.updateContext({
|
|
1087
|
+
environment: {
|
|
1088
|
+
isCI: ci,
|
|
1089
|
+
noColor: process.env.NO_COLOR !== void 0,
|
|
1090
|
+
forceColor: process.env.FORCE_COLOR !== void 0,
|
|
1091
|
+
term: process.env.TERM ?? ""
|
|
1092
|
+
},
|
|
1093
|
+
colorSupport
|
|
1094
|
+
});
|
|
1095
|
+
k.on("environment:check", () => {
|
|
1096
|
+
const ctx = k.getContext();
|
|
1097
|
+
const env = ctx.environment;
|
|
1098
|
+
if (env?.noColor) {
|
|
1099
|
+
return { level: 0, enabled: false };
|
|
1100
|
+
}
|
|
1101
|
+
if (env?.forceColor) {
|
|
1102
|
+
const level = parseInt(process.env.FORCE_COLOR ?? "0", 10);
|
|
1103
|
+
return { level: Math.max(0, Math.min(3, level)), enabled: true };
|
|
1104
|
+
}
|
|
1105
|
+
if (ci) {
|
|
1106
|
+
return { level: 1, enabled: colorSupport.hasBasic };
|
|
1107
|
+
}
|
|
1108
|
+
return { level: colorSupport.level, enabled: colorSupport.level > 0 };
|
|
1109
|
+
});
|
|
1110
|
+
k.on("environment:override", (data) => {
|
|
1111
|
+
const { level, noColor, forceColor } = data;
|
|
1112
|
+
if (noColor !== void 0) {
|
|
1113
|
+
process.env.NO_COLOR = noColor ? "1" : "";
|
|
1114
|
+
}
|
|
1115
|
+
if (forceColor !== void 0 && level !== void 0) {
|
|
1116
|
+
process.env.FORCE_COLOR = String(level);
|
|
1117
|
+
}
|
|
1118
|
+
const newColorSupport = detectColorSupport(level);
|
|
1119
|
+
k.updateContext({ colorSupport: newColorSupport });
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
// src/core/factory.ts
|
|
1126
|
+
function createPigment(options) {
|
|
1127
|
+
const colorSupport = detectColorSupport(options?.level);
|
|
1128
|
+
const noColor = options?.noColor ?? false;
|
|
1129
|
+
const forceColor = options?.forceColor ?? false;
|
|
1130
|
+
const level = noColor ? 0 : forceColor ? options?.level ?? 3 : colorSupport.level;
|
|
1131
|
+
const kernel = (0, import_plugin.createKernel)({
|
|
1132
|
+
context: {
|
|
1133
|
+
colorSupport: { ...colorSupport, level },
|
|
1134
|
+
level,
|
|
1135
|
+
enabled: level > 0,
|
|
1136
|
+
styles: /* @__PURE__ */ new Map(),
|
|
1137
|
+
utils: {
|
|
1138
|
+
hexToRgb,
|
|
1139
|
+
hslToRgb,
|
|
1140
|
+
rgbToAnsi256,
|
|
1141
|
+
detectColorSupport,
|
|
1142
|
+
supportsColor: detectColorSupport
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
});
|
|
1146
|
+
kernel.use(baseColorsPlugin());
|
|
1147
|
+
kernel.use(modifiersPlugin());
|
|
1148
|
+
kernel.use(ansi256Plugin());
|
|
1149
|
+
kernel.use(trueColorPlugin());
|
|
1150
|
+
kernel.use(nestingPlugin());
|
|
1151
|
+
kernel.use(environmentPlugin());
|
|
1152
|
+
if (options?.plugins) {
|
|
1153
|
+
for (const plugin of options.plugins) {
|
|
1154
|
+
kernel.use(plugin);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
kernel.init();
|
|
1158
|
+
const pigment2 = createProxyPigment(kernel);
|
|
1159
|
+
const builder = new BuilderPigment(kernel);
|
|
1160
|
+
Object.defineProperty(pigment2, "builder", { value: builder, enumerable: false });
|
|
1161
|
+
Object.defineProperty(pigment2, "level", { value: level, enumerable: true });
|
|
1162
|
+
Object.defineProperty(pigment2, "supportsColor", { value: colorSupport, enumerable: true });
|
|
1163
|
+
return pigment2;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
// src/core/chalk.ts
|
|
1167
|
+
var Chalk = class {
|
|
1168
|
+
level;
|
|
1169
|
+
supportsColor;
|
|
1170
|
+
pigment;
|
|
1171
|
+
constructor(options) {
|
|
1172
|
+
const colorSupport = detectColorSupport(options?.level);
|
|
1173
|
+
this.level = options?.level ?? colorSupport.level;
|
|
1174
|
+
this.supportsColor = colorSupport;
|
|
1175
|
+
this.pigment = createPigment({ level: this.level });
|
|
1176
|
+
}
|
|
1177
|
+
red(text) {
|
|
1178
|
+
return this.pigment.red(text);
|
|
1179
|
+
}
|
|
1180
|
+
green(text) {
|
|
1181
|
+
return this.pigment.green(text);
|
|
1182
|
+
}
|
|
1183
|
+
yellow(text) {
|
|
1184
|
+
return this.pigment.yellow(text);
|
|
1185
|
+
}
|
|
1186
|
+
blue(text) {
|
|
1187
|
+
return this.pigment.blue(text);
|
|
1188
|
+
}
|
|
1189
|
+
magenta(text) {
|
|
1190
|
+
return this.pigment.magenta(text);
|
|
1191
|
+
}
|
|
1192
|
+
cyan(text) {
|
|
1193
|
+
return this.pigment.cyan(text);
|
|
1194
|
+
}
|
|
1195
|
+
white(text) {
|
|
1196
|
+
return this.pigment.white(text);
|
|
1197
|
+
}
|
|
1198
|
+
black(text) {
|
|
1199
|
+
return this.pigment.black(text);
|
|
1200
|
+
}
|
|
1201
|
+
redBright(text) {
|
|
1202
|
+
return this.pigment.redBright(text);
|
|
1203
|
+
}
|
|
1204
|
+
greenBright(text) {
|
|
1205
|
+
return this.pigment.greenBright(text);
|
|
1206
|
+
}
|
|
1207
|
+
yellowBright(text) {
|
|
1208
|
+
return this.pigment.yellowBright(text);
|
|
1209
|
+
}
|
|
1210
|
+
blueBright(text) {
|
|
1211
|
+
return this.pigment.blueBright(text);
|
|
1212
|
+
}
|
|
1213
|
+
magentaBright(text) {
|
|
1214
|
+
return this.pigment.magentaBright(text);
|
|
1215
|
+
}
|
|
1216
|
+
cyanBright(text) {
|
|
1217
|
+
return this.pigment.cyanBright(text);
|
|
1218
|
+
}
|
|
1219
|
+
whiteBright(text) {
|
|
1220
|
+
return this.pigment.whiteBright(text);
|
|
1221
|
+
}
|
|
1222
|
+
gray(text) {
|
|
1223
|
+
return this.pigment.gray(text);
|
|
1224
|
+
}
|
|
1225
|
+
grey(text) {
|
|
1226
|
+
return this.pigment.grey(text);
|
|
1227
|
+
}
|
|
1228
|
+
bgRed(text) {
|
|
1229
|
+
return this.pigment.bgRed(text);
|
|
1230
|
+
}
|
|
1231
|
+
bgGreen(text) {
|
|
1232
|
+
return this.pigment.bgGreen(text);
|
|
1233
|
+
}
|
|
1234
|
+
bgYellow(text) {
|
|
1235
|
+
return this.pigment.bgYellow(text);
|
|
1236
|
+
}
|
|
1237
|
+
bgBlue(text) {
|
|
1238
|
+
return this.pigment.bgBlue(text);
|
|
1239
|
+
}
|
|
1240
|
+
bgMagenta(text) {
|
|
1241
|
+
return this.pigment.bgMagenta(text);
|
|
1242
|
+
}
|
|
1243
|
+
bgCyan(text) {
|
|
1244
|
+
return this.pigment.bgCyan(text);
|
|
1245
|
+
}
|
|
1246
|
+
bgWhite(text) {
|
|
1247
|
+
return this.pigment.bgWhite(text);
|
|
1248
|
+
}
|
|
1249
|
+
bgBlack(text) {
|
|
1250
|
+
return this.pigment.bgBlack(text);
|
|
1251
|
+
}
|
|
1252
|
+
bgRedBright(text) {
|
|
1253
|
+
return this.pigment.bgRedBright(text);
|
|
1254
|
+
}
|
|
1255
|
+
bgGreenBright(text) {
|
|
1256
|
+
return this.pigment.bgGreenBright(text);
|
|
1257
|
+
}
|
|
1258
|
+
bgYellowBright(text) {
|
|
1259
|
+
return this.pigment.bgYellowBright(text);
|
|
1260
|
+
}
|
|
1261
|
+
bgBlueBright(text) {
|
|
1262
|
+
return this.pigment.bgBlueBright(text);
|
|
1263
|
+
}
|
|
1264
|
+
bgMagentaBright(text) {
|
|
1265
|
+
return this.pigment.bgMagentaBright(text);
|
|
1266
|
+
}
|
|
1267
|
+
bgCyanBright(text) {
|
|
1268
|
+
return this.pigment.bgCyanBright(text);
|
|
1269
|
+
}
|
|
1270
|
+
bgWhiteBright(text) {
|
|
1271
|
+
return this.pigment.bgWhiteBright(text);
|
|
1272
|
+
}
|
|
1273
|
+
bgGray(text) {
|
|
1274
|
+
return this.pigment.bgGray(text);
|
|
1275
|
+
}
|
|
1276
|
+
bgGrey(text) {
|
|
1277
|
+
return this.pigment.bgGrey(text);
|
|
1278
|
+
}
|
|
1279
|
+
bold(text) {
|
|
1280
|
+
return this.pigment.bold(text);
|
|
1281
|
+
}
|
|
1282
|
+
dim(text) {
|
|
1283
|
+
return this.pigment.dim(text);
|
|
1284
|
+
}
|
|
1285
|
+
italic(text) {
|
|
1286
|
+
return this.pigment.italic(text);
|
|
1287
|
+
}
|
|
1288
|
+
underline(text) {
|
|
1289
|
+
return this.pigment.underline(text);
|
|
1290
|
+
}
|
|
1291
|
+
strikethrough(text) {
|
|
1292
|
+
return this.pigment.strikethrough(text);
|
|
1293
|
+
}
|
|
1294
|
+
inverse(text) {
|
|
1295
|
+
return this.pigment.inverse(text);
|
|
1296
|
+
}
|
|
1297
|
+
hidden(text) {
|
|
1298
|
+
return this.pigment.hidden(text);
|
|
1299
|
+
}
|
|
1300
|
+
reset(text) {
|
|
1301
|
+
return this.pigment.reset(text);
|
|
1302
|
+
}
|
|
1303
|
+
visible(text) {
|
|
1304
|
+
return this.supportsColor.level > 0 ? text : text;
|
|
1305
|
+
}
|
|
1306
|
+
rgb(r, g, b) {
|
|
1307
|
+
const coloredPigment = this.pigment.rgb(r, g, b);
|
|
1308
|
+
return (text) => coloredPigment(text);
|
|
1309
|
+
}
|
|
1310
|
+
bgRgb(r, g, b) {
|
|
1311
|
+
const coloredPigment = this.pigment.bgRgb(r, g, b);
|
|
1312
|
+
return (text) => coloredPigment(text);
|
|
1313
|
+
}
|
|
1314
|
+
hex(color) {
|
|
1315
|
+
const coloredPigment = this.pigment.hex(color);
|
|
1316
|
+
return (text) => coloredPigment(text);
|
|
1317
|
+
}
|
|
1318
|
+
bgHex(color) {
|
|
1319
|
+
const coloredPigment = this.pigment.bgHex(color);
|
|
1320
|
+
return (text) => coloredPigment(text);
|
|
1321
|
+
}
|
|
1322
|
+
ansi256(code) {
|
|
1323
|
+
const coloredPigment = this.pigment.ansi256(code);
|
|
1324
|
+
return (text) => coloredPigment(text);
|
|
1325
|
+
}
|
|
1326
|
+
bgAnsi256(code) {
|
|
1327
|
+
const coloredPigment = this.pigment.bgAnsi256(code);
|
|
1328
|
+
return (text) => coloredPigment(text);
|
|
1329
|
+
}
|
|
1330
|
+
};
|
|
1331
|
+
|
|
1332
|
+
// src/core/chalk-default.ts
|
|
1333
|
+
var chalk = new Chalk();
|
|
1334
|
+
chalk.level = chalk.supportsColor.level;
|
|
1335
|
+
var chalk_default_default = chalk;
|
|
1336
|
+
|
|
1337
|
+
// src/core/styler.ts
|
|
1338
|
+
function applyStyle(text, open, close) {
|
|
1339
|
+
if (text === "") {
|
|
1340
|
+
return "";
|
|
1341
|
+
}
|
|
1342
|
+
return `${open}${text}${close}`;
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
// src/core/composer.ts
|
|
1346
|
+
var bold = (text) => applyStyle(text, "\x1B[1m", "\x1B[22m");
|
|
1347
|
+
var dim = (text) => applyStyle(text, "\x1B[2m", "\x1B[22m");
|
|
1348
|
+
var italic = (text) => applyStyle(text, "\x1B[3m", "\x1B[23m");
|
|
1349
|
+
var underline = (text) => applyStyle(text, "\x1B[4m", "\x1B[24m");
|
|
1350
|
+
var strikethrough = (text) => applyStyle(text, "\x1B[9m", "\x1B[29m");
|
|
1351
|
+
var inverse = (text) => applyStyle(text, "\x1B[7m", "\x1B[27m");
|
|
1352
|
+
var hidden = (text) => applyStyle(text, "\x1B[8m", "\x1B[28m");
|
|
1353
|
+
var reset = (text) => applyStyle(text, "\x1B[0m", "\x1B[0m");
|
|
1354
|
+
var black = (text) => applyStyle(text, "\x1B[30m", "\x1B[39m");
|
|
1355
|
+
var red = (text) => applyStyle(text, "\x1B[31m", "\x1B[39m");
|
|
1356
|
+
var green = (text) => applyStyle(text, "\x1B[32m", "\x1B[39m");
|
|
1357
|
+
var yellow = (text) => applyStyle(text, "\x1B[33m", "\x1B[39m");
|
|
1358
|
+
var blue = (text) => applyStyle(text, "\x1B[34m", "\x1B[39m");
|
|
1359
|
+
var magenta = (text) => applyStyle(text, "\x1B[35m", "\x1B[39m");
|
|
1360
|
+
var cyan = (text) => applyStyle(text, "\x1B[36m", "\x1B[39m");
|
|
1361
|
+
var white = (text) => applyStyle(text, "\x1B[37m", "\x1B[39m");
|
|
1362
|
+
var blackBright = (text) => applyStyle(text, "\x1B[90m", "\x1B[39m");
|
|
1363
|
+
var redBright = (text) => applyStyle(text, "\x1B[91m", "\x1B[39m");
|
|
1364
|
+
var greenBright = (text) => applyStyle(text, "\x1B[92m", "\x1B[39m");
|
|
1365
|
+
var yellowBright = (text) => applyStyle(text, "\x1B[93m", "\x1B[39m");
|
|
1366
|
+
var blueBright = (text) => applyStyle(text, "\x1B[94m", "\x1B[39m");
|
|
1367
|
+
var magentaBright = (text) => applyStyle(text, "\x1B[95m", "\x1B[39m");
|
|
1368
|
+
var cyanBright = (text) => applyStyle(text, "\x1B[96m", "\x1B[39m");
|
|
1369
|
+
var whiteBright = (text) => applyStyle(text, "\x1B[97m", "\x1B[39m");
|
|
1370
|
+
var gray = blackBright;
|
|
1371
|
+
var grey = blackBright;
|
|
1372
|
+
var bgBlack = (text) => applyStyle(text, "\x1B[40m", "\x1B[49m");
|
|
1373
|
+
var bgRed = (text) => applyStyle(text, "\x1B[41m", "\x1B[49m");
|
|
1374
|
+
var bgGreen = (text) => applyStyle(text, "\x1B[42m", "\x1B[49m");
|
|
1375
|
+
var bgYellow = (text) => applyStyle(text, "\x1B[43m", "\x1B[49m");
|
|
1376
|
+
var bgBlue = (text) => applyStyle(text, "\x1B[44m", "\x1B[49m");
|
|
1377
|
+
var bgMagenta = (text) => applyStyle(text, "\x1B[45m", "\x1B[49m");
|
|
1378
|
+
var bgCyan = (text) => applyStyle(text, "\x1B[46m", "\x1B[49m");
|
|
1379
|
+
var bgWhite = (text) => applyStyle(text, "\x1B[47m", "\x1B[49m");
|
|
1380
|
+
var bgBlackBright = (text) => applyStyle(text, "\x1B[100m", "\x1B[49m");
|
|
1381
|
+
var bgRedBright = (text) => applyStyle(text, "\x1B[101m", "\x1B[49m");
|
|
1382
|
+
var bgGreenBright = (text) => applyStyle(text, "\x1B[102m", "\x1B[49m");
|
|
1383
|
+
var bgYellowBright = (text) => applyStyle(text, "\x1B[103m", "\x1B[49m");
|
|
1384
|
+
var bgBlueBright = (text) => applyStyle(text, "\x1B[104m", "\x1B[49m");
|
|
1385
|
+
var bgMagentaBright = (text) => applyStyle(text, "\x1B[105m", "\x1B[49m");
|
|
1386
|
+
var bgCyanBright = (text) => applyStyle(text, "\x1B[106m", "\x1B[49m");
|
|
1387
|
+
var bgWhiteBright = (text) => applyStyle(text, "\x1B[107m", "\x1B[49m");
|
|
1388
|
+
var bgGray = bgBlackBright;
|
|
1389
|
+
var bgGrey = bgBlackBright;
|
|
1390
|
+
function compose(...stylers) {
|
|
1391
|
+
return (text) => {
|
|
1392
|
+
return stylers.reduce((acc, styler) => styler(acc), text);
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
// src/index.ts
|
|
1397
|
+
var import_plugin2 = require("@oxog/plugin");
|
|
1398
|
+
|
|
1399
|
+
// src/plugins/index.ts
|
|
1400
|
+
var plugins_exports = {};
|
|
1401
|
+
__export(plugins_exports, {
|
|
1402
|
+
ansi256Plugin: () => ansi256Plugin,
|
|
1403
|
+
baseColorsPlugin: () => baseColorsPlugin,
|
|
1404
|
+
boxPlugin: () => boxPlugin,
|
|
1405
|
+
environmentPlugin: () => environmentPlugin,
|
|
1406
|
+
gradientPlugin: () => gradientPlugin,
|
|
1407
|
+
modifiersPlugin: () => modifiersPlugin,
|
|
1408
|
+
nestingPlugin: () => nestingPlugin,
|
|
1409
|
+
pigmentPlugin: () => pigmentPlugin,
|
|
1410
|
+
semanticPlugin: () => semanticPlugin,
|
|
1411
|
+
templatePlugin: () => templatePlugin,
|
|
1412
|
+
themePlugin: () => themePlugin,
|
|
1413
|
+
trueColorPlugin: () => trueColorPlugin
|
|
1414
|
+
});
|
|
1415
|
+
|
|
1416
|
+
// src/plugins/optional/gradient.ts
|
|
1417
|
+
function gradientPlugin(options) {
|
|
1418
|
+
const steps = options?.steps ?? 10;
|
|
1419
|
+
return {
|
|
1420
|
+
name: "gradient",
|
|
1421
|
+
version: "1.0.0",
|
|
1422
|
+
install(kernel) {
|
|
1423
|
+
const k = kernel;
|
|
1424
|
+
k.updateContext({
|
|
1425
|
+
gradient: {
|
|
1426
|
+
steps,
|
|
1427
|
+
enabled: true
|
|
1428
|
+
}
|
|
1429
|
+
});
|
|
1430
|
+
k.on("style:gradient", (data) => {
|
|
1431
|
+
const { start, end, text, steps: gradientSteps = steps } = data;
|
|
1432
|
+
const startRgb = start.startsWith("#") ? hexToRgb(start) : start.startsWith("rgb(") ? parseRgb(start) : hexToRgb(start);
|
|
1433
|
+
const endRgb = end.startsWith("#") ? hexToRgb(end) : end.startsWith("rgb(") ? parseRgb(end) : hexToRgb(end);
|
|
1434
|
+
if (!startRgb || !endRgb) {
|
|
1435
|
+
return text;
|
|
1436
|
+
}
|
|
1437
|
+
const colors = interpolateColors(startRgb, endRgb, text.length, gradientSteps);
|
|
1438
|
+
let result = "";
|
|
1439
|
+
for (let i = 0; i < text.length; i++) {
|
|
1440
|
+
const colorIndex = Math.floor(i / (text.length - 1) * (colors.length - 1));
|
|
1441
|
+
const color = colors[colorIndex];
|
|
1442
|
+
if (color) {
|
|
1443
|
+
const open = `\x1B[38;2;${color.r};${color.g};${color.b}m`;
|
|
1444
|
+
result += `${open}${text[i]}\x1B[39m`;
|
|
1445
|
+
} else {
|
|
1446
|
+
result += text[i];
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
return result;
|
|
1450
|
+
});
|
|
1451
|
+
k.on("style:rainbow", (data) => {
|
|
1452
|
+
const { text, steps: rainbowSteps = steps } = data;
|
|
1453
|
+
const colors = generateRainbowColors(text.length, rainbowSteps);
|
|
1454
|
+
let result = "";
|
|
1455
|
+
for (let i = 0; i < text.length; i++) {
|
|
1456
|
+
const colorIndex = i % colors.length;
|
|
1457
|
+
const color = colors[colorIndex];
|
|
1458
|
+
if (color) {
|
|
1459
|
+
const open = `\x1B[38;2;${color.r};${color.g};${color.b}m`;
|
|
1460
|
+
result += `${open}${text[i]}\x1B[39m`;
|
|
1461
|
+
} else {
|
|
1462
|
+
result += text[i];
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
return result;
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
};
|
|
1469
|
+
}
|
|
1470
|
+
function parseRgb(rgb) {
|
|
1471
|
+
const match = rgb.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
1472
|
+
if (!match) {
|
|
1473
|
+
return null;
|
|
1474
|
+
}
|
|
1475
|
+
return { r: Number(match[1]), g: Number(match[2]), b: Number(match[3]) };
|
|
1476
|
+
}
|
|
1477
|
+
function interpolateColors(start, end, length, steps) {
|
|
1478
|
+
const colors = [];
|
|
1479
|
+
for (let i = 0; i < steps; i++) {
|
|
1480
|
+
const ratio = i / (steps - 1);
|
|
1481
|
+
colors.push({
|
|
1482
|
+
r: Math.round(start.r + (end.r - start.r) * ratio),
|
|
1483
|
+
g: Math.round(start.g + (end.g - start.g) * ratio),
|
|
1484
|
+
b: Math.round(start.b + (end.b - start.b) * ratio)
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
return colors;
|
|
1488
|
+
}
|
|
1489
|
+
function generateRainbowColors(length, steps) {
|
|
1490
|
+
const colors = [];
|
|
1491
|
+
for (let i = 0; i < steps; i++) {
|
|
1492
|
+
const hue = i / steps * 360;
|
|
1493
|
+
const rgb = hslToRgb(hue, 100, 50);
|
|
1494
|
+
colors.push(rgb);
|
|
1495
|
+
}
|
|
1496
|
+
return colors;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
// src/plugins/optional/theme.ts
|
|
1500
|
+
function themePlugin(options) {
|
|
1501
|
+
const preset = options?.preset ?? "monokai";
|
|
1502
|
+
const custom = options?.custom ?? {};
|
|
1503
|
+
const theme = Object.keys(custom).length > 0 ? { ...custom } : THEME_PRESETS[preset];
|
|
1504
|
+
if (!theme) {
|
|
1505
|
+
throw new Error(`Unknown theme preset: ${preset}`);
|
|
1506
|
+
}
|
|
1507
|
+
return {
|
|
1508
|
+
name: "theme",
|
|
1509
|
+
version: "1.0.0",
|
|
1510
|
+
install(kernel) {
|
|
1511
|
+
const k = kernel;
|
|
1512
|
+
k.updateContext({
|
|
1513
|
+
theme: {
|
|
1514
|
+
preset,
|
|
1515
|
+
colors: theme,
|
|
1516
|
+
enabled: true
|
|
1517
|
+
}
|
|
1518
|
+
});
|
|
1519
|
+
k.on("style:theme", (data) => {
|
|
1520
|
+
const { type, text } = data;
|
|
1521
|
+
const color = theme[type];
|
|
1522
|
+
if (!color) {
|
|
1523
|
+
throw new Error(`Unknown theme color type: ${String(type)}`);
|
|
1524
|
+
}
|
|
1525
|
+
const ctx = k.getContext();
|
|
1526
|
+
const hexToRgb2 = ctx.utils?.hexToRgb;
|
|
1527
|
+
if (!hexToRgb2) {
|
|
1528
|
+
throw new Error("hexToRgb utility not available");
|
|
1529
|
+
}
|
|
1530
|
+
const { r, g, b } = hexToRgb2(color);
|
|
1531
|
+
const open = `\x1B[38;2;${r};${g};${b}m`;
|
|
1532
|
+
return `${open}${text}\x1B[39m`;
|
|
1533
|
+
});
|
|
1534
|
+
k.on("style:theme:keyword", (data) => {
|
|
1535
|
+
k.emit("style:theme", { type: "keyword", text: data.text });
|
|
1536
|
+
});
|
|
1537
|
+
k.on("style:theme:string", (data) => {
|
|
1538
|
+
k.emit("style:theme", { type: "string", text: data.text });
|
|
1539
|
+
});
|
|
1540
|
+
k.on("style:theme:number", (data) => {
|
|
1541
|
+
k.emit("style:theme", { type: "number", text: data.text });
|
|
1542
|
+
});
|
|
1543
|
+
k.on("style:theme:comment", (data) => {
|
|
1544
|
+
k.emit("style:theme", { type: "comment", text: data.text });
|
|
1545
|
+
});
|
|
1546
|
+
k.on("style:theme:error", (data) => {
|
|
1547
|
+
k.emit("style:theme", { type: "error", text: data.text });
|
|
1548
|
+
});
|
|
1549
|
+
k.on("style:theme:success", (data) => {
|
|
1550
|
+
k.emit("style:theme", { type: "success", text: data.text });
|
|
1551
|
+
});
|
|
1552
|
+
k.on("style:theme:warning", (data) => {
|
|
1553
|
+
k.emit("style:theme", { type: "warning", text: data.text });
|
|
1554
|
+
});
|
|
1555
|
+
k.on("style:theme:info", (data) => {
|
|
1556
|
+
k.emit("style:theme", { type: "info", text: data.text });
|
|
1557
|
+
});
|
|
1558
|
+
}
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
// src/plugins/optional/semantic.ts
|
|
1563
|
+
function semanticPlugin(options) {
|
|
1564
|
+
const colors = options ?? {};
|
|
1565
|
+
const defaultColors = {
|
|
1566
|
+
success: colors.success ?? "#50fa7b",
|
|
1567
|
+
error: colors.error ?? "#ff5555",
|
|
1568
|
+
warning: colors.warning ?? "#ffb86c",
|
|
1569
|
+
info: colors.info ?? "#8be9fd",
|
|
1570
|
+
debug: colors.debug ?? "#6272a4"
|
|
1571
|
+
};
|
|
1572
|
+
return {
|
|
1573
|
+
name: "semantic",
|
|
1574
|
+
version: "1.0.0",
|
|
1575
|
+
install(kernel) {
|
|
1576
|
+
const k = kernel;
|
|
1577
|
+
k.updateContext({
|
|
1578
|
+
semantic: {
|
|
1579
|
+
colors: defaultColors,
|
|
1580
|
+
enabled: true
|
|
1581
|
+
}
|
|
1582
|
+
});
|
|
1583
|
+
const ctx = k.getContext();
|
|
1584
|
+
const hexToRgb2 = ctx.utils?.hexToRgb;
|
|
1585
|
+
if (!hexToRgb2) {
|
|
1586
|
+
throw new Error("hexToRgb utility not available");
|
|
1587
|
+
}
|
|
1588
|
+
k.on("style:success", (data) => {
|
|
1589
|
+
const { r, g, b } = hexToRgb2(defaultColors.success);
|
|
1590
|
+
return `\x1B[38;2;${r};${g};${b}m${data.text}\x1B[39m`;
|
|
1591
|
+
});
|
|
1592
|
+
k.on("style:error", (data) => {
|
|
1593
|
+
const { r, g, b } = hexToRgb2(defaultColors.error);
|
|
1594
|
+
return `\x1B[38;2;${r};${g};${b}m${data.text}\x1B[39m`;
|
|
1595
|
+
});
|
|
1596
|
+
k.on("style:warning", (data) => {
|
|
1597
|
+
const { r, g, b } = hexToRgb2(defaultColors.warning);
|
|
1598
|
+
return `\x1B[38;2;${r};${g};${b}m${data.text}\x1B[39m`;
|
|
1599
|
+
});
|
|
1600
|
+
k.on("style:info", (data) => {
|
|
1601
|
+
const { r, g, b } = hexToRgb2(defaultColors.info);
|
|
1602
|
+
return `\x1B[38;2;${r};${g};${b}m${data.text}\x1B[39m`;
|
|
1603
|
+
});
|
|
1604
|
+
k.on("style:debug", (data) => {
|
|
1605
|
+
const { r, g, b } = hexToRgb2(defaultColors.debug);
|
|
1606
|
+
return `\x1B[38;2;${r};${g};${b}m${data.text}\x1B[39m`;
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
// src/plugins/optional/box.ts
|
|
1613
|
+
function boxPlugin(options) {
|
|
1614
|
+
const border = options?.border ?? "single";
|
|
1615
|
+
const padding = options?.padding ?? 1;
|
|
1616
|
+
return {
|
|
1617
|
+
name: "box",
|
|
1618
|
+
version: "1.0.0",
|
|
1619
|
+
install(kernel) {
|
|
1620
|
+
const k = kernel;
|
|
1621
|
+
k.updateContext({
|
|
1622
|
+
box: {
|
|
1623
|
+
border,
|
|
1624
|
+
padding,
|
|
1625
|
+
enabled: true,
|
|
1626
|
+
borders: BOX_BORDERS
|
|
1627
|
+
}
|
|
1628
|
+
});
|
|
1629
|
+
k.on("style:box", (data) => {
|
|
1630
|
+
const { text, border: boxBorder = border, padding: boxPadding = padding, bgColor } = data;
|
|
1631
|
+
const chars = BOX_BORDERS[boxBorder];
|
|
1632
|
+
const lines = text.split("\n");
|
|
1633
|
+
const width = Math.max(...lines.map((l) => l.length)) + boxPadding * 2;
|
|
1634
|
+
const pad = " ".repeat(boxPadding);
|
|
1635
|
+
const top = `${chars.tl}${chars.h.repeat(width)}${chars.tr}`;
|
|
1636
|
+
const middle = lines.map((line) => {
|
|
1637
|
+
const paddedLine = pad + line.padEnd(width - boxPadding * 2) + pad;
|
|
1638
|
+
return `${chars.v}${paddedLine}${chars.v}`;
|
|
1639
|
+
});
|
|
1640
|
+
const bottom = `${chars.bl}${chars.h.repeat(width)}${chars.br}`;
|
|
1641
|
+
const result = [top, ...middle, bottom].join("\n");
|
|
1642
|
+
if (bgColor) {
|
|
1643
|
+
const ctx = k.getContext();
|
|
1644
|
+
const hexToRgb2 = ctx.utils?.hexToRgb;
|
|
1645
|
+
if (!hexToRgb2) {
|
|
1646
|
+
throw new Error("hexToRgb utility not available");
|
|
1647
|
+
}
|
|
1648
|
+
const { r, g, b } = hexToRgb2(bgColor);
|
|
1649
|
+
return `\x1B[48;2;${r};${g};${b}m${result}\x1B[49m`;
|
|
1650
|
+
}
|
|
1651
|
+
return result;
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1654
|
+
};
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
// src/plugins/optional/template.ts
|
|
1658
|
+
function templatePlugin() {
|
|
1659
|
+
return {
|
|
1660
|
+
name: "template",
|
|
1661
|
+
version: "1.0.0",
|
|
1662
|
+
install(kernel) {
|
|
1663
|
+
const k = kernel;
|
|
1664
|
+
k.updateContext({
|
|
1665
|
+
template: {
|
|
1666
|
+
enabled: true
|
|
1667
|
+
}
|
|
1668
|
+
});
|
|
1669
|
+
k.on("style:template", (data) => {
|
|
1670
|
+
const { strings, values } = data;
|
|
1671
|
+
let result = "";
|
|
1672
|
+
for (let i = 0; i < strings.length; i++) {
|
|
1673
|
+
result += strings[i];
|
|
1674
|
+
if (i < values.length) {
|
|
1675
|
+
const value = values[i];
|
|
1676
|
+
if (typeof value === "string") {
|
|
1677
|
+
const match = value.match(/^\{(.+)\}(.*)$/);
|
|
1678
|
+
if (match) {
|
|
1679
|
+
const [, styleExpression, text] = match;
|
|
1680
|
+
result += parseStyleExpression(styleExpression, text, k);
|
|
1681
|
+
} else {
|
|
1682
|
+
result += value;
|
|
1683
|
+
}
|
|
1684
|
+
} else {
|
|
1685
|
+
result += String(value);
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
return result;
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
function parseStyleExpression(expression, text, kernel) {
|
|
1695
|
+
const parts = expression.split(".");
|
|
1696
|
+
let current = kernel.getContext();
|
|
1697
|
+
for (const part of parts) {
|
|
1698
|
+
if (current && typeof current === "object" && part in current) {
|
|
1699
|
+
current = current[part];
|
|
1700
|
+
} else {
|
|
1701
|
+
return text;
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
if (typeof current === "function") {
|
|
1705
|
+
return current(text);
|
|
1706
|
+
}
|
|
1707
|
+
return text;
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
// src/plugins/ecosystem/pigment-plugin.ts
|
|
1711
|
+
function pigmentPlugin(options) {
|
|
1712
|
+
const theme = options?.theme ?? "monokai";
|
|
1713
|
+
const level = options?.level;
|
|
1714
|
+
return {
|
|
1715
|
+
name: "pigment",
|
|
1716
|
+
version: "1.0.0",
|
|
1717
|
+
install(kernel) {
|
|
1718
|
+
const k = kernel;
|
|
1719
|
+
const themeColors = THEME_PRESETS[theme] ?? THEME_PRESETS.monokai;
|
|
1720
|
+
const pigment2 = createPigment({ level });
|
|
1721
|
+
k.pigment = pigment2;
|
|
1722
|
+
k.updateContext({
|
|
1723
|
+
ecosystem: {
|
|
1724
|
+
theme,
|
|
1725
|
+
level,
|
|
1726
|
+
themeColors,
|
|
1727
|
+
enabled: true
|
|
1728
|
+
},
|
|
1729
|
+
colors: {
|
|
1730
|
+
red: pigment2.red,
|
|
1731
|
+
green: pigment2.green,
|
|
1732
|
+
yellow: pigment2.yellow,
|
|
1733
|
+
blue: pigment2.blue,
|
|
1734
|
+
magenta: pigment2.magenta,
|
|
1735
|
+
cyan: pigment2.cyan,
|
|
1736
|
+
white: pigment2.white,
|
|
1737
|
+
black: pigment2.black,
|
|
1738
|
+
bold: pigment2.bold,
|
|
1739
|
+
dim: pigment2.dim,
|
|
1740
|
+
italic: pigment2.italic,
|
|
1741
|
+
underline: pigment2.underline
|
|
1742
|
+
}
|
|
1743
|
+
});
|
|
1744
|
+
k.on("ecosystem:style", (data) => {
|
|
1745
|
+
const { text, type, preset: presetOverride } = data;
|
|
1746
|
+
const activeTheme = presetOverride ? THEME_PRESETS[presetOverride] ?? themeColors : themeColors;
|
|
1747
|
+
if (type && activeTheme[type]) {
|
|
1748
|
+
const color = activeTheme[type];
|
|
1749
|
+
const { r, g, b } = hexToRgb(color);
|
|
1750
|
+
return `\x1B[38;2;${r};${g};${b}m${text}\x1B[39m`;
|
|
1751
|
+
}
|
|
1752
|
+
return text;
|
|
1753
|
+
});
|
|
1754
|
+
k.on("ecosystem:format", (data) => {
|
|
1755
|
+
const { message, level: level2 = "info" } = data;
|
|
1756
|
+
const colorMap = {
|
|
1757
|
+
info: themeColors.info,
|
|
1758
|
+
success: themeColors.success,
|
|
1759
|
+
warning: themeColors.warning,
|
|
1760
|
+
error: themeColors.error
|
|
1761
|
+
};
|
|
1762
|
+
const color = colorMap[level2] ?? themeColors.info;
|
|
1763
|
+
const { r, g, b } = hexToRgb(color);
|
|
1764
|
+
return `\x1B[38;2;${r};${g};${b}m${message}\x1B[39m`;
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
};
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
// src/index.ts
|
|
1771
|
+
var pigment = createPigment();
|
|
1772
|
+
Object.assign(pigment, {
|
|
1773
|
+
bold,
|
|
1774
|
+
dim,
|
|
1775
|
+
italic,
|
|
1776
|
+
underline,
|
|
1777
|
+
strikethrough,
|
|
1778
|
+
inverse,
|
|
1779
|
+
hidden,
|
|
1780
|
+
reset,
|
|
1781
|
+
black,
|
|
1782
|
+
red,
|
|
1783
|
+
green,
|
|
1784
|
+
yellow,
|
|
1785
|
+
blue,
|
|
1786
|
+
magenta,
|
|
1787
|
+
cyan,
|
|
1788
|
+
white,
|
|
1789
|
+
blackBright,
|
|
1790
|
+
redBright,
|
|
1791
|
+
greenBright,
|
|
1792
|
+
yellowBright,
|
|
1793
|
+
blueBright,
|
|
1794
|
+
magentaBright,
|
|
1795
|
+
cyanBright,
|
|
1796
|
+
whiteBright,
|
|
1797
|
+
gray,
|
|
1798
|
+
grey,
|
|
1799
|
+
bgBlack,
|
|
1800
|
+
bgRed,
|
|
1801
|
+
bgGreen,
|
|
1802
|
+
bgYellow,
|
|
1803
|
+
bgBlue,
|
|
1804
|
+
bgMagenta,
|
|
1805
|
+
bgCyan,
|
|
1806
|
+
bgWhite,
|
|
1807
|
+
bgBlackBright,
|
|
1808
|
+
bgRedBright,
|
|
1809
|
+
bgGreenBright,
|
|
1810
|
+
bgYellowBright,
|
|
1811
|
+
bgBlueBright,
|
|
1812
|
+
bgMagentaBright,
|
|
1813
|
+
bgCyanBright,
|
|
1814
|
+
bgWhiteBright,
|
|
1815
|
+
bgGray,
|
|
1816
|
+
bgGrey
|
|
1817
|
+
});
|
|
1818
|
+
var index_default = chalk_default_default;
|
|
1819
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1820
|
+
0 && (module.exports = {
|
|
1821
|
+
BuilderPigment,
|
|
1822
|
+
bgBlack,
|
|
1823
|
+
bgBlackBright,
|
|
1824
|
+
bgBlue,
|
|
1825
|
+
bgBlueBright,
|
|
1826
|
+
bgCyan,
|
|
1827
|
+
bgCyanBright,
|
|
1828
|
+
bgGray,
|
|
1829
|
+
bgGreen,
|
|
1830
|
+
bgGreenBright,
|
|
1831
|
+
bgGrey,
|
|
1832
|
+
bgMagenta,
|
|
1833
|
+
bgMagentaBright,
|
|
1834
|
+
bgRed,
|
|
1835
|
+
bgRedBright,
|
|
1836
|
+
bgWhite,
|
|
1837
|
+
bgWhiteBright,
|
|
1838
|
+
bgYellow,
|
|
1839
|
+
bgYellowBright,
|
|
1840
|
+
black,
|
|
1841
|
+
blackBright,
|
|
1842
|
+
blue,
|
|
1843
|
+
blueBright,
|
|
1844
|
+
bold,
|
|
1845
|
+
compose,
|
|
1846
|
+
createKernel,
|
|
1847
|
+
createPigment,
|
|
1848
|
+
cyan,
|
|
1849
|
+
cyanBright,
|
|
1850
|
+
detectColorSupport,
|
|
1851
|
+
detectPlatform,
|
|
1852
|
+
dim,
|
|
1853
|
+
gray,
|
|
1854
|
+
green,
|
|
1855
|
+
greenBright,
|
|
1856
|
+
grey,
|
|
1857
|
+
hasTTY,
|
|
1858
|
+
hexToRgb,
|
|
1859
|
+
hidden,
|
|
1860
|
+
hslToRgb,
|
|
1861
|
+
inverse,
|
|
1862
|
+
isBrowser,
|
|
1863
|
+
isCI,
|
|
1864
|
+
isNode,
|
|
1865
|
+
isWindows,
|
|
1866
|
+
italic,
|
|
1867
|
+
magenta,
|
|
1868
|
+
magentaBright,
|
|
1869
|
+
pigment,
|
|
1870
|
+
plugins,
|
|
1871
|
+
red,
|
|
1872
|
+
redBright,
|
|
1873
|
+
reset,
|
|
1874
|
+
rgbToAnsi256,
|
|
1875
|
+
strikethrough,
|
|
1876
|
+
supportsColor,
|
|
1877
|
+
underline,
|
|
1878
|
+
validateHex,
|
|
1879
|
+
white,
|
|
1880
|
+
whiteBright,
|
|
1881
|
+
yellow,
|
|
1882
|
+
yellowBright
|
|
1883
|
+
});
|
|
1884
|
+
//# sourceMappingURL=index.cjs.map
|