@reliverse/relico 1.0.2 → 1.1.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/bin/utils.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Logs a "FATAL" error, triggers a debugger in dev, and throws an error.
3
+ */
4
+ export declare const shouldNeverHappen: (msg?: string, ...args: any[]) => never;
package/bin/utils.js ADDED
@@ -0,0 +1,10 @@
1
+ function isDevEnv() {
2
+ return process.env.NODE_ENV === "development";
3
+ }
4
+ export const shouldNeverHappen = (msg, ...args) => {
5
+ console.error(msg, ...args);
6
+ if (isDevEnv()) {
7
+ debugger;
8
+ }
9
+ throw new Error(`This should never happen: ${msg}`);
10
+ };
package/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "dependencies": {
3
3
  "@reliverse/runtime": "^1.0.3",
4
- "bun-types": "^1.2.8",
5
- "c12": "^3.0.2",
4
+ "c12": "^3.0.3",
6
5
  "pathe": "^2.0.3"
7
6
  },
8
- "description": "@reliverse/relico is doing its best to improve your terminal colorization experience by leveraging TypeScript and TypeBox for enhanced reliability and type safety.",
7
+ "description": "@reliverse/relico is a themeable, chainable, typed, truecolor-powered, modern terminal styling toolkit. Designed to make your CLI output colorful, accessible, and human-friendly. It gives you a flexible way to apply colors and styles with reliability and a smart developer experience baked in. Built for humans, not just terminals.",
9
8
  "homepage": "https://docs.reliverse.org",
10
9
  "license": "MIT",
11
10
  "name": "@reliverse/relico",
12
11
  "type": "module",
13
- "version": "1.0.2",
12
+ "version": "1.1.1",
14
13
  "author": "reliverse",
15
14
  "bugs": {
16
15
  "email": "blefnk@gmail.com",
@@ -25,22 +24,23 @@
25
24
  },
26
25
  "devDependencies": {
27
26
  "@biomejs/biome": "1.9.4",
28
- "@eslint/js": "^9.23.0",
27
+ "@eslint/js": "^9.26.0",
29
28
  "@reliverse/relidler-cfg": "^1.1.3",
30
29
  "@stylistic/eslint-plugin": "^4.2.0",
31
- "@types/bun": "^1.2.8",
32
- "@types/node": "^22.13.14",
33
- "eslint": "^9.23.0",
30
+ "@total-typescript/ts-reset": "^0.6.1",
31
+ "@types/bun": "^1.2.13",
32
+ "@types/node": "^22.15.17",
33
+ "eslint": "^9.26.0",
34
34
  "eslint-plugin-no-relative-import-paths": "^1.6.1",
35
- "eslint-plugin-perfectionist": "^4.10.1",
35
+ "eslint-plugin-perfectionist": "^4.13.0",
36
36
  "jiti": "^2.4.2",
37
- "knip": "^5.46.4",
38
- "typescript": "^5.8.2",
39
- "typescript-eslint": "^8.29.0",
40
- "vitest": "^3.1.1"
37
+ "knip": "^5.55.1",
38
+ "typescript": "^5.8.3",
39
+ "typescript-eslint": "^8.32.1",
40
+ "vitest": "^3.1.3"
41
41
  },
42
42
  "exports": {
43
- ".": "./bin/main.js"
43
+ ".": "./bin/mod.js"
44
44
  },
45
45
  "files": [
46
46
  "bin",
@@ -48,8 +48,8 @@
48
48
  "README.md",
49
49
  "LICENSE"
50
50
  ],
51
- "main": "./bin/main.js",
52
- "module": "./bin/main.js",
51
+ "main": "./bin/mod.js",
52
+ "module": "./bin/mod.js",
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  }
package/bin/main.d.ts DELETED
@@ -1,130 +0,0 @@
1
- /** A color definition: [primary, secondary, optional replacement]. */
2
- export type ColorDefinition = [string, string, string?];
3
- /** A list of default color keys. */
4
- export declare const defaultColorKeys: readonly ["reset", "bold", "dim", "italic", "underline", "inverse", "hidden", "strikethrough", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "gray", "bgBlack", "bgRed", "bgGreen", "bgYellow", "bgBlue", "bgMagenta", "bgCyan", "bgWhite", "blackBright", "redBright", "greenBright", "yellowBright", "blueBright", "magentaBright", "cyanBright", "whiteBright", "bgBlackBright", "bgRedBright", "bgGreenBright", "bgYellowBright", "bgBlueBright", "bgMagentaBright", "bgCyanBright", "bgWhiteBright"];
5
- export type DefaultColorKeys = (typeof defaultColorKeys)[number];
6
- /** A map of custom color definitions. IntelliSense will suggest only valid keys. */
7
- export type ColorMap = Partial<Record<DefaultColorKeys, ColorDefinition>>;
8
- /**
9
- * `relico.config.ts` configuration options.
10
- */
11
- export type RelicoConfig = {
12
- /**
13
- * Determines which ANSI mode is used:
14
- * - 0: no color
15
- * - 1: basic ANSI (8 colors)
16
- * - 2: 256 color palette
17
- * - 3: 24-bit truecolor
18
- */
19
- colorLevel?: 0 | 1 | 2 | 3;
20
- /**
21
- * Theme to use for color definitions.
22
- * - "primary": primary theme
23
- * - "secondary": secondary theme
24
- */
25
- theme?: "primary" | "secondary";
26
- /**
27
- * Custom color definitions.
28
- * - Use IntelliSense to see available colors.
29
- * - Theming: ["primary", "secondary"]
30
- */
31
- customColors?: ColorMap;
32
- };
33
- export type IRelicoColors = {
34
- reset(text: string | number): string;
35
- bold(text: string | number): string;
36
- dim(text: string | number): string;
37
- italic(text: string | number): string;
38
- underline(text: string | number): string;
39
- inverse(text: string | number): string;
40
- hidden(text: string | number): string;
41
- strikethrough(text: string | number): string;
42
- black(text: string | number): string;
43
- red(text: string | number): string;
44
- green(text: string | number): string;
45
- yellow(text: string | number): string;
46
- blue(text: string | number): string;
47
- magenta(text: string | number): string;
48
- cyan(text: string | number): string;
49
- white(text: string | number): string;
50
- gray(text: string | number): string;
51
- bgBlack(text: string | number): string;
52
- bgRed(text: string | number): string;
53
- bgGreen(text: string | number): string;
54
- bgYellow(text: string | number): string;
55
- bgBlue(text: string | number): string;
56
- bgMagenta(text: string | number): string;
57
- bgCyan(text: string | number): string;
58
- bgWhite(text: string | number): string;
59
- blackBright(text: string | number): string;
60
- redBright(text: string | number): string;
61
- greenBright(text: string | number): string;
62
- yellowBright(text: string | number): string;
63
- blueBright(text: string | number): string;
64
- magentaBright(text: string | number): string;
65
- cyanBright(text: string | number): string;
66
- whiteBright(text: string | number): string;
67
- bgBlackBright(text: string | number): string;
68
- bgRedBright(text: string | number): string;
69
- bgGreenBright(text: string | number): string;
70
- bgYellowBright(text: string | number): string;
71
- bgBlueBright(text: string | number): string;
72
- bgMagentaBright(text: string | number): string;
73
- bgCyanBright(text: string | number): string;
74
- bgWhiteBright(text: string | number): string;
75
- [k: string]: (text: string | number) => string;
76
- };
77
- export declare const re: IRelicoColors;
78
- /**
79
- * Configures the library with a partial or complete
80
- * `RelicoConfig`. Invalid fields are just ignored.
81
- */
82
- export declare function configure(userInput: unknown): void;
83
- /** Returns a color function by name (or `reset` or identity if not found). */
84
- export declare function getColor(name: string): (text: string | number) => string;
85
- /** Colorizes text with a color function. */
86
- export declare function colorize(name: string, text: string | number): string;
87
- /** Sets the color level (0=none, 1=basic, 2=256, 3=truecolor). */
88
- export declare function setColorLevel(level: 0 | 1 | 2 | 3): void;
89
- /** Returns a custom "rgb" color function if level is truecolor, otherwise identity. */
90
- export declare function rgb(r: number, g: number, b: number): (text: string | number) => string;
91
- export type ColorSupport = {
92
- isColorSupported: boolean;
93
- isForced: boolean;
94
- isDisabled: boolean;
95
- terminalName: string;
96
- };
97
- export declare const colorSupport: ColorSupport;
98
- export declare function initUserConfig(): Promise<void>;
99
- /**
100
- * Provides type safety and IntelliSense for user configuration.
101
- * Example usage in `relico.config.ts`:
102
- * ```ts
103
- * import { defineConfig } from "@reliverse/relico-cfg";
104
- * export default defineConfig({
105
- * // Set the color level: 3 for truecolor
106
- * colorLevel: 3,
107
- * // Choose the theme: "primary" or "secondary"
108
- * theme: "secondary",
109
- * // Override specific colors
110
- * // - Use Intellisense to see the available colors
111
- * // - Theming: ["primary", "secondary"]
112
- * customColors: {
113
- * blue: ["#5f87ff", "#5f87ff"],
114
- * red: ["#ff5555", "#ff0000"],
115
- * green: ["#00ff00", "#00cc00"],
116
- * // Note: The following text formatting
117
- * // colors can be defined only via ANSI:
118
- * // reset: ["\x1b[0m", "\x1b[0m"],
119
- * // bold: ["\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"],
120
- * // dim: ["\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"],
121
- * // italic: ["\x1b[3m", "\x1b[23m"],
122
- * // underline: ["\x1b[4m", "\x1b[24m"],
123
- * // inverse: ["\x1b[7m", "\x1b[27m"],
124
- * // hidden: ["\x1b[8m", "\x1b[28m"],
125
- * // strikethrough: ["\x1b[9m", "\x1b[29m"],
126
- * },
127
- * });
128
- * ```
129
- */
130
- export declare function defineConfig(config: RelicoConfig): RelicoConfig;
package/bin/main.js DELETED
@@ -1,361 +0,0 @@
1
- import { getCurrentTerminalName } from "@reliverse/runtime";
2
- import { env, isWindows } from "@reliverse/runtime";
3
- import { loadConfig } from "c12";
4
- export const defaultColorKeys = [
5
- "reset",
6
- "bold",
7
- "dim",
8
- "italic",
9
- "underline",
10
- "inverse",
11
- "hidden",
12
- "strikethrough",
13
- "black",
14
- "red",
15
- "green",
16
- "yellow",
17
- "blue",
18
- "magenta",
19
- "cyan",
20
- "white",
21
- "gray",
22
- "bgBlack",
23
- "bgRed",
24
- "bgGreen",
25
- "bgYellow",
26
- "bgBlue",
27
- "bgMagenta",
28
- "bgCyan",
29
- "bgWhite",
30
- "blackBright",
31
- "redBright",
32
- "greenBright",
33
- "yellowBright",
34
- "blueBright",
35
- "magentaBright",
36
- "cyanBright",
37
- "whiteBright",
38
- "bgBlackBright",
39
- "bgRedBright",
40
- "bgGreenBright",
41
- "bgYellowBright",
42
- "bgBlueBright",
43
- "bgMagentaBright",
44
- "bgCyanBright",
45
- "bgWhiteBright"
46
- ];
47
- const argv = typeof process === "undefined" ? [] : process.argv;
48
- const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
49
- const isForced = "FORCE_COLOR" in env || argv.includes("--color");
50
- const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
51
- const isCompatibleTerminal = typeof process !== "undefined" && Boolean(process.stdout) && Boolean(process.stdout.isTTY) && env.TERM !== "dumb";
52
- const colorterm = (env.COLORTERM ?? "").toLowerCase();
53
- const supportsTrueColor = colorterm === "truecolor" || colorterm === "24bit";
54
- function detectColorLevel() {
55
- if (isDisabled) return 0;
56
- if (isForced) return 3;
57
- if (supportsTrueColor) return 3;
58
- if (isWindows) return 2;
59
- if (isCI) return 2;
60
- if (isCompatibleTerminal) return 2;
61
- return 0;
62
- }
63
- const baseColors = {
64
- // Text formatting
65
- reset: ["\x1B[0m", "\x1B[0m"],
66
- bold: ["\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"],
67
- dim: ["\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"],
68
- italic: ["\x1B[3m", "\x1B[23m"],
69
- underline: ["\x1B[4m", "\x1B[24m"],
70
- inverse: ["\x1B[7m", "\x1B[27m"],
71
- hidden: ["\x1B[8m", "\x1B[28m"],
72
- strikethrough: ["\x1B[9m", "\x1B[29m"],
73
- // Foreground colors.
74
- black: ["#000000", "#000000"],
75
- red: ["#ff5555", "#ff0000"],
76
- green: ["#00ff00", "#00ff00"],
77
- yellow: ["#ffff00", "#ffff00"],
78
- blue: ["#0000ff", "#0000ff"],
79
- magenta: ["#ff00ff", "#ff00ff"],
80
- cyan: ["#00ffff", "#00ffff"],
81
- white: ["#ffffff", "#ffffff"],
82
- gray: ["#808080", "#808080"],
83
- // Background colors.
84
- bgBlack: ["#000000", "#000000"],
85
- bgRed: ["#ff5555", "#ff0000"],
86
- bgGreen: ["#00ff00", "#00ff00"],
87
- bgYellow: ["#ffff00", "#ffff00"],
88
- bgBlue: ["#0000ff", "#0000ff"],
89
- bgMagenta: ["#ff00ff", "#ff00ff"],
90
- bgCyan: ["#00ffff", "#00ffff"],
91
- bgWhite: ["#ffffff", "#ffffff"],
92
- // Bright colors.
93
- blackBright: ["#000000", "#000000"],
94
- redBright: ["#ff5555", "#ff5555"],
95
- greenBright: ["#50fa7b", "#50fa7b"],
96
- yellowBright: ["#f1fa8c", "#f1fa8c"],
97
- blueBright: ["#24bdff", "#24bdff"],
98
- magentaBright: ["#ff79c6", "#ff79c6"],
99
- cyanBright: ["#8be9fd", "#8be9fd"],
100
- whiteBright: ["#ffffff", "#ffffff"],
101
- // Bright background colors.
102
- bgBlackBright: ["#000000", "#000000"],
103
- bgRedBright: ["#ff5555", "#ff5555"],
104
- bgGreenBright: ["#50fa7b", "#50fa7b"],
105
- bgYellowBright: ["#f1fa8c", "#f1fa8c"],
106
- bgBlueBright: ["#24bdff", "#24bdff"],
107
- bgMagentaBright: ["#ff79c6", "#ff79c6"],
108
- bgCyanBright: ["#8be9fd", "#8be9fd"],
109
- bgWhiteBright: ["#ffffff", "#ffffff"]
110
- };
111
- const windowsTerminalColors = {
112
- ...baseColors,
113
- red: ["#ff5555", "#ff5555"],
114
- green: ["#50fa7b", "#50fa7b"],
115
- yellow: ["#f1fa8c", "#f1fa8c"],
116
- blue: ["#6272a4", "#6272a4"],
117
- magenta: ["#ff79c6", "#ff79c6"],
118
- cyan: ["#8be9fd", "#8be9fd"]
119
- };
120
- let config = {
121
- colorLevel: detectColorLevel(),
122
- theme: "primary"
123
- // default theme; can be overridden in user config
124
- };
125
- let colorMap = {};
126
- let colorFunctions = {};
127
- function hexToRGB(hex) {
128
- if (hex.startsWith("#")) {
129
- hex = hex.slice(1);
130
- }
131
- if (hex.length === 3) {
132
- hex = hex.split("").map((c) => c + c).join("");
133
- }
134
- if (hex.length !== 6) {
135
- throw new Error(`Invalid hex color: ${hex}`);
136
- }
137
- const r = Number.parseInt(hex.substring(0, 2), 16);
138
- const g = Number.parseInt(hex.substring(2, 4), 16);
139
- const b = Number.parseInt(hex.substring(4, 6), 16);
140
- return { r, g, b };
141
- }
142
- function hexToAnsiParts(hex, isBg = false) {
143
- const { r, g, b } = hexToRGB(hex);
144
- const open = isBg ? `\x1B[48;2;${r};${g};${b}m` : `\x1B[38;2;${r};${g};${b}m`;
145
- const close = isBg ? "\x1B[49m" : "\x1B[39m";
146
- return { open, close };
147
- }
148
- function hexToAnsi256(hex, isBg = false) {
149
- const { r, g, b } = hexToRGB(hex);
150
- const r5 = Math.round(r / 51);
151
- const g5 = Math.round(g / 51);
152
- const b5 = Math.round(b / 51);
153
- const index = 16 + 36 * r5 + 6 * g5 + b5;
154
- return isBg ? `\x1B[48;5;${index}m` : `\x1B[38;5;${index}m`;
155
- }
156
- const basicColors = [
157
- { name: "black", rgb: { r: 0, g: 0, b: 0 }, fg: 30, bg: 40 },
158
- { name: "red", rgb: { r: 205, g: 0, b: 0 }, fg: 31, bg: 41 },
159
- { name: "green", rgb: { r: 0, g: 205, b: 0 }, fg: 32, bg: 42 },
160
- { name: "yellow", rgb: { r: 205, g: 205, b: 0 }, fg: 33, bg: 43 },
161
- { name: "blue", rgb: { r: 0, g: 0, b: 238 }, fg: 34, bg: 44 },
162
- { name: "magenta", rgb: { r: 205, g: 0, b: 205 }, fg: 35, bg: 45 },
163
- { name: "cyan", rgb: { r: 0, g: 205, b: 205 }, fg: 36, bg: 46 },
164
- { name: "white", rgb: { r: 229, g: 229, b: 229 }, fg: 37, bg: 47 }
165
- ];
166
- function hexToAnsiBasic(hex, isBg = false) {
167
- const { r, g, b } = hexToRGB(hex);
168
- let bestMatch = basicColors[0];
169
- let bestDistance = Number.MAX_VALUE;
170
- for (const color of basicColors) {
171
- const dr = r - color.rgb.r;
172
- const dg = g - color.rgb.g;
173
- const db = b - color.rgb.b;
174
- const distance = dr * dr + dg * dg + db * db;
175
- if (distance < bestDistance) {
176
- bestDistance = distance;
177
- bestMatch = color;
178
- }
179
- }
180
- const code = isBg ? bestMatch.bg : bestMatch.fg;
181
- return `\x1B[${code}m`;
182
- }
183
- function convertColorDefinition(key, def) {
184
- const isBg = key.toLowerCase().startsWith("bg");
185
- const theme = config.theme ?? "primary";
186
- const chosen = theme === "primary" ? def[0] : def[1];
187
- function convert(str) {
188
- if (!str.startsWith("#")) return str;
189
- if (config.colorLevel === 3) {
190
- return hexToAnsiParts(str, isBg).open;
191
- }
192
- if (config.colorLevel === 2) {
193
- return hexToAnsi256(str, isBg);
194
- }
195
- if (config.colorLevel === 1) {
196
- return hexToAnsiBasic(str, isBg);
197
- }
198
- return "";
199
- }
200
- const openConverted = convert(chosen);
201
- const close = isBg ? "\x1B[49m" : "\x1B[39m";
202
- const rep = def[2] ? def[2].startsWith("#") ? convert(def[2]) : def[2] : void 0;
203
- return [openConverted, close, rep];
204
- }
205
- function buildColorMap(cfg) {
206
- const terminalName = getCurrentTerminalName();
207
- const isWinTerm = terminalName === "Windows Terminal";
208
- if (cfg.colorLevel === 0) {
209
- const noColorMap = {};
210
- for (const k of Object.keys(baseColors)) {
211
- noColorMap[k] = ["", "", ""];
212
- }
213
- return noColorMap;
214
- }
215
- let builtIn = { ...baseColors };
216
- if (cfg.customColors) {
217
- for (const [k, v] of Object.entries(cfg.customColors)) {
218
- builtIn[k] = v;
219
- }
220
- }
221
- if (isWinTerm && cfg.colorLevel === 3) {
222
- builtIn = { ...windowsTerminalColors, ...builtIn };
223
- }
224
- for (const key of Object.keys(builtIn)) {
225
- builtIn[key] = convertColorDefinition(key, builtIn[key]);
226
- }
227
- return builtIn;
228
- }
229
- function createFormatter(open, close, replace = open) {
230
- const escapedClose = close.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
231
- const regex = new RegExp(escapedClose, "g");
232
- return (input) => {
233
- const stringed = String(input);
234
- return open + stringed.replace(regex, replace) + close;
235
- };
236
- }
237
- function identityColor(text) {
238
- return String(text);
239
- }
240
- const typedRe = {
241
- reset: identityColor,
242
- bold: identityColor,
243
- dim: identityColor,
244
- italic: identityColor,
245
- underline: identityColor,
246
- inverse: identityColor,
247
- hidden: identityColor,
248
- strikethrough: identityColor,
249
- black: identityColor,
250
- red: identityColor,
251
- green: identityColor,
252
- yellow: identityColor,
253
- blue: identityColor,
254
- magenta: identityColor,
255
- cyan: identityColor,
256
- white: identityColor,
257
- gray: identityColor,
258
- bgBlack: identityColor,
259
- bgRed: identityColor,
260
- bgGreen: identityColor,
261
- bgYellow: identityColor,
262
- bgBlue: identityColor,
263
- bgMagenta: identityColor,
264
- bgCyan: identityColor,
265
- bgWhite: identityColor,
266
- blackBright: identityColor,
267
- redBright: identityColor,
268
- greenBright: identityColor,
269
- yellowBright: identityColor,
270
- blueBright: identityColor,
271
- magentaBright: identityColor,
272
- cyanBright: identityColor,
273
- whiteBright: identityColor,
274
- bgBlackBright: identityColor,
275
- bgRedBright: identityColor,
276
- bgGreenBright: identityColor,
277
- bgYellowBright: identityColor,
278
- bgBlueBright: identityColor,
279
- bgMagentaBright: identityColor,
280
- bgCyanBright: identityColor,
281
- bgWhiteBright: identityColor
282
- };
283
- export const re = typedRe;
284
- function refreshTypedRe() {
285
- for (const colorName of Object.keys(typedRe)) {
286
- typedRe[colorName] = identityColor;
287
- }
288
- for (const [k, fn] of Object.entries(colorFunctions)) {
289
- typedRe[k] = fn;
290
- }
291
- }
292
- function initColorFunctions() {
293
- colorFunctions = {};
294
- if (config.colorLevel === 0) {
295
- for (const k of Object.keys(baseColors)) {
296
- colorFunctions[k] = identityColor;
297
- }
298
- return;
299
- }
300
- for (const [key, [open, close, replace]] of Object.entries(colorMap)) {
301
- colorFunctions[key] = createFormatter(open, close, replace ?? open);
302
- }
303
- }
304
- function rebuild() {
305
- colorMap = buildColorMap(config);
306
- initColorFunctions();
307
- refreshTypedRe();
308
- }
309
- rebuild();
310
- export function configure(userInput) {
311
- let newConfig;
312
- if (typeof userInput === "object" && userInput !== null) {
313
- newConfig = { ...config, ...userInput };
314
- } else {
315
- newConfig = { ...config };
316
- }
317
- config = newConfig;
318
- rebuild();
319
- }
320
- export function getColor(name) {
321
- const maybeFn = colorFunctions[name];
322
- if (maybeFn) return maybeFn;
323
- const resetFn = colorFunctions.reset;
324
- if (resetFn) return resetFn;
325
- return identityColor;
326
- }
327
- export function colorize(name, text) {
328
- const fn = getColor(name);
329
- return fn(text);
330
- }
331
- export function setColorLevel(level) {
332
- configure({ colorLevel: level });
333
- }
334
- export function rgb(r, g, b) {
335
- if (config.colorLevel === 3) {
336
- const open = `\x1B[38;2;${r};${g};${b}m`;
337
- const close = "\x1B[39m";
338
- return createFormatter(open, close);
339
- }
340
- return identityColor;
341
- }
342
- export const colorSupport = {
343
- isColorSupported: getConfig().colorLevel !== 0,
344
- isForced,
345
- isDisabled,
346
- terminalName: getCurrentTerminalName()
347
- };
348
- export async function initUserConfig() {
349
- try {
350
- const { config: userConfig } = await loadConfig({ name: "relico" });
351
- configure(userConfig);
352
- } catch (err) {
353
- console.warn("Failed to load user config via c12:", err);
354
- }
355
- }
356
- export function defineConfig(config2) {
357
- return config2;
358
- }
359
- function getConfig() {
360
- return { ...config };
361
- }