@reliverse/relico 1.2.0 → 1.3.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright (c) 2024 Nazarii Korniienko
3
+ Copyright (c) Nazar Kornienko (blefnk), Bleverse, Reliverse
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -4,20 +4,20 @@
4
4
 
5
5
  [sponsor](https://github.com/sponsors/blefnk) — [discord](https://discord.gg/Pb8uKbwpsJ) — [repo](https://github.com/reliverse/relico) — [npm](https://npmjs.com/@reliverse/relico)
6
6
 
7
- ## 🌟 Why Relico?
7
+ ## Why Relico?
8
8
 
9
- Because terminal styling shouldnt feel like duct tape. **Relico** brings design-system-level polish to your CLI logs, banners, errors, and output — without battling your runtime, shell, or platform. Terminal styling should be *fun*, not frustrating. Relico makes it feel *right*.
9
+ Because terminal styling shouldn't feel like duct tape. **Relico** brings design-system-level polish to your CLI logs, banners, errors, and output — without battling your runtime, shell, or platform. Terminal styling should be *fun*, not frustrating. Relico makes it feel *right*.
10
10
 
11
+ - ⚡ **Blazing-fast & lightweight** — type-safe, runtime-safe, build-time aware, zero bloat, zero dependencies, zero configuration
11
12
  - 🎨 **80+ built-in colors** — easily customize or override with your own [`HEX`](https://chatgpt.com/share/67fd24cd-e7b0-8008-a815-f33d01f33758) palette
12
13
  - 🧩 **Themeable by default** — end-users can configure themes+typography+colors via `relico.config.ts`, developers via `await initUserConfig({ ... })`
13
14
  - 🌈 **Smart color detection** — full support for truecolor (16M), 256-color, and fallback modes across environments
14
15
  - 🦄 **A modern alternative** to `chalk`, `kleur`, `colorette`, `gradient-string`, and legacy console hacks
15
16
  - 🧠 **Typed, chainable, DX-optimized** — with autocompletion, inline docs, and expressive API ergonomics
16
17
  - 🌿 **Respects your environment** — including `NO_COLOR`, `FORCE_COLOR`, and terminal capabilities
17
- - ⚡ **Blazing-fast & lightweight** — zero bloat, runtime-safe, build-time aware, minimal dependencies
18
18
  - 🛡️ **Cross-platform & runtime-ready** — works everywhere — even when your users' terminals are weird — in Node.js, Bun, Deno, CI, Windows, macOS, Linux, Docker & more
19
19
  - 🎯 **Precision-crafted ANSI output** — every color, reset, and style code is finely tuned for contrast, legibility, and glitch-free rendering — even in flaky terminals (as far as Node.js permits)
20
- - 🦾 **Relico isnt just about color** — its about communication — make your CLI users' output more than readable — make it feel *intentional*.
20
+ - 🦾 **Relico isn't just about color** — it's about communication — make your CLI users' output more than readable — make it feel *intentional*.
21
21
 
22
22
  <img src="./example/example.png" width="50%" alt="Available Relico colors" />
23
23
 
@@ -28,6 +28,64 @@ bun add @reliverse/relico
28
28
  # bun • pnpm • yarn • npm
29
29
  ```
30
30
 
31
+ ## Performance
32
+
33
+ ```bash
34
+ $ bun bench
35
+ $ bun examples/benchmarks/performance.ts
36
+
37
+ 🚀 Relico Performance Benchmarks
38
+ ==================================================
39
+ C:/B/R/reliverse/relico/dist-npm/bin/mod.js
40
+
41
+ Basic color access: 107.02ms (934 379 ops/sec)
42
+ Chained colors: 191.49ms (522 227 ops/sec)
43
+ RGB color creation: 73.79ms (1 355 276 ops/sec)
44
+ Hex color creation: 87.73ms (1 139 866 ops/sec)
45
+ HSL color creation: 78.10ms (1 280 444 ops/sec)
46
+ Chain function: 226.13ms (442 219 ops/sec)
47
+ Background colors: 208.55ms (479 492 ops/sec)
48
+ Bright colors: 124.96ms (800 282 ops/sec)
49
+ Pastel colors: 126.03ms (793 446 ops/sec)
50
+ Multiline text (small): 165.08ms (605 769 ops/sec)
51
+ Multiline text (large): 1089.44ms (91 790 ops/sec)
52
+
53
+ Bundle Size Test:
54
+ Core exports imported: 5
55
+ ```
56
+
57
+ ```bash
58
+ $ bun size
59
+ $ bun examples/benchmarks/bundle-size.ts
60
+
61
+ 📦 Bundle Size Analysis
62
+ ==============================
63
+ C:/B/R/reliverse/relico/dist-npm/bin/mod.js
64
+
65
+ Size:
66
+ - File size: 12.9KB
67
+ - Declaration file size: 2.9KB
68
+ - Total bundle size: 15.8KB
69
+
70
+ Breakdown:
71
+ - Color data: 554B (4.2%)
72
+ - Logic: 12.4KB (95.8%)
73
+ ```
74
+
75
+ ## 🔥 Important Notice
76
+
77
+ Relico (v1.3.0+) was recently rewritten from scratch:
78
+
79
+ - To have zero dependencies and zero configuration
80
+ - Include only the really necessary for daily usage features
81
+ - To be as fast as possible
82
+
83
+ Some missing important features may be added back in the coming future.
84
+
85
+ This means everything or most of the things described below in this readme may be different now.
86
+
87
+ The readme will be updated soon.
88
+
31
89
  ## Configuration
32
90
 
33
91
  **If you're end-user OR developer, create `relico.config.ts` in your root**:
@@ -119,7 +177,7 @@ const brandColors: DefaultColorKeys[] = ["magentaBright", "maroon"];
119
177
 
120
178
  ## Color Detection
121
179
 
122
- Relico detects your terminals capability:
180
+ Relico detects your terminal's capability:
123
181
 
124
182
  ```ts
125
183
  import { colorSupport } from "@reliverse/relico";
@@ -293,7 +351,7 @@ Relico draws inspiration from all — and goes beyond them with modern configs,
293
351
 
294
352
  ## 🛠 Contributing
295
353
 
296
- Wed love your help! Bug? Feature? Example? PR it!
354
+ We'd love your help! Bug? Feature? Example? PR it!
297
355
  Or hop into [Discord](https://discord.gg/Pb8uKbwpsJ) to discuss CLI theming and terminal art 💜
298
356
 
299
357
  ```bash
package/bin/mod.d.ts CHANGED
@@ -1,357 +1,75 @@
1
- /** A color definition: [primary, secondary]. */
2
- export type ColorDefinition = [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", "redPastel", "greenPastel", "yellowPastel", "bluePastel", "magentaPastel", "cyanPastel", "bgRedPastel", "bgGreenPastel", "bgYellowPastel", "bgBluePastel", "bgMagentaPastel", "bgCyanPastel", "orange", "pink", "purple", "teal", "lime", "brown", "navy", "maroon", "olive", "silver", "bgOrange", "bgPink", "bgPurple", "bgTeal", "bgLime", "bgBrown", "bgNavy", "bgMaroon", "bgOlive", "bgSilver", "gray10", "gray20", "gray30", "gray40", "gray50", "gray60", "gray70", "gray80", "gray90"];
5
- /** Union of all default color keys */
6
- export type DefaultColorKeys = (typeof defaultColorKeys)[number];
7
- /**
8
- * Format keys that must NOT be overridden by the user.
9
- * We'll exclude them from IntelliSense and also skip them at runtime.
10
- */
11
- type RestrictedKeys = "reset" | "bold" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough";
12
- /** All the keys user is allowed to override */
13
- type OverridableColorKeys = Exclude<DefaultColorKeys, RestrictedKeys>;
14
- /** A map of user-overridable color definitions (no format keys) */
15
- export type OverridableColorMap = Partial<Record<OverridableColorKeys, ColorDefinition>>;
16
- /**
17
- * `relico.config.ts` configuration options.
18
- * Note: `customColors` is restricted to OverridableColorMap.
19
- */
20
- export type RelicoConfig = {
21
- /**
22
- * Determines which ANSI mode is used:
23
- * - 0: no color
24
- * - 1: basic ANSI (8 colors)
25
- * - 2: 256 color palette
26
- * - 3: 24-bit truecolor (default)
27
- */
28
- colorLevel?: 0 | 1 | 2 | 3;
29
- /**
30
- * Theme to use for color definitions.
31
- * - "primary": primary theme (default)
32
- * - "secondary": secondary theme
33
- */
34
- theme?: "primary" | "secondary";
35
- /**
36
- * Custom color definitions.
37
- * - Theming: ["primary", "secondary"]
38
- */
39
- customColors?: OverridableColorMap;
40
- /**
41
- * Enable auto-detection of terminal color support
42
- * Default: true
43
- */
44
- autoDetect?: boolean;
1
+ type ColorLevel = 0 | 1 | 2 | 3;
2
+ type Rgb = {
3
+ r: number;
4
+ g: number;
5
+ b: number;
45
6
  };
46
- export type IRelicoColors = {
47
- reset(text: string | number): string;
48
- bold(text: string | number): string;
49
- dim(text: string | number): string;
50
- italic(text: string | number): string;
51
- underline(text: string | number): string;
52
- inverse(text: string | number): string;
53
- hidden(text: string | number): string;
54
- strikethrough(text: string | number): string;
55
- black(text: string | number): string;
56
- red(text: string | number): string;
57
- green(text: string | number): string;
58
- yellow(text: string | number): string;
59
- blue(text: string | number): string;
60
- magenta(text: string | number): string;
61
- cyan(text: string | number): string;
62
- white(text: string | number): string;
63
- gray(text: string | number): string;
64
- bgBlack(text: string | number): string;
65
- bgRed(text: string | number): string;
66
- bgGreen(text: string | number): string;
67
- bgYellow(text: string | number): string;
68
- bgBlue(text: string | number): string;
69
- bgMagenta(text: string | number): string;
70
- bgCyan(text: string | number): string;
71
- bgWhite(text: string | number): string;
72
- blackBright(text: string | number): string;
73
- redBright(text: string | number): string;
74
- greenBright(text: string | number): string;
75
- yellowBright(text: string | number): string;
76
- blueBright(text: string | number): string;
77
- magentaBright(text: string | number): string;
78
- cyanBright(text: string | number): string;
79
- whiteBright(text: string | number): string;
80
- bgBlackBright(text: string | number): string;
81
- bgRedBright(text: string | number): string;
82
- bgGreenBright(text: string | number): string;
83
- bgYellowBright(text: string | number): string;
84
- bgBlueBright(text: string | number): string;
85
- bgMagentaBright(text: string | number): string;
86
- bgCyanBright(text: string | number): string;
87
- bgWhiteBright(text: string | number): string;
88
- redPastel(text: string | number): string;
89
- greenPastel(text: string | number): string;
90
- yellowPastel(text: string | number): string;
91
- bluePastel(text: string | number): string;
92
- magentaPastel(text: string | number): string;
93
- cyanPastel(text: string | number): string;
94
- bgRedPastel(text: string | number): string;
95
- bgGreenPastel(text: string | number): string;
96
- bgYellowPastel(text: string | number): string;
97
- bgBluePastel(text: string | number): string;
98
- bgMagentaPastel(text: string | number): string;
99
- bgCyanPastel(text: string | number): string;
100
- orange(text: string | number): string;
101
- pink(text: string | number): string;
102
- purple(text: string | number): string;
103
- teal(text: string | number): string;
104
- lime(text: string | number): string;
105
- brown(text: string | number): string;
106
- navy(text: string | number): string;
107
- maroon(text: string | number): string;
108
- olive(text: string | number): string;
109
- silver(text: string | number): string;
110
- bgOrange(text: string | number): string;
111
- bgPink(text: string | number): string;
112
- bgPurple(text: string | number): string;
113
- bgTeal(text: string | number): string;
114
- bgLime(text: string | number): string;
115
- bgBrown(text: string | number): string;
116
- bgNavy(text: string | number): string;
117
- bgMaroon(text: string | number): string;
118
- bgOlive(text: string | number): string;
119
- bgSilver(text: string | number): string;
120
- gray10(text: string | number): string;
121
- gray20(text: string | number): string;
122
- gray30(text: string | number): string;
123
- gray40(text: string | number): string;
124
- gray50(text: string | number): string;
125
- gray60(text: string | number): string;
126
- gray70(text: string | number): string;
127
- gray80(text: string | number): string;
128
- gray90(text: string | number): string;
7
+ type SgrOp = {
8
+ kind: "style";
9
+ open: number[];
10
+ } | {
11
+ kind: "fg-basic";
12
+ idx: number;
13
+ bright: boolean;
14
+ } | {
15
+ kind: "bg-basic";
16
+ idx: number;
17
+ bright: boolean;
18
+ } | {
19
+ kind: "fg-256";
20
+ code: number;
21
+ } | {
22
+ kind: "bg-256";
23
+ code: number;
24
+ } | {
25
+ kind: "fg-true";
26
+ rgb: Rgb;
27
+ } | {
28
+ kind: "bg-true";
29
+ rgb: Rgb;
129
30
  };
130
- export declare const re: IRelicoColors;
131
- /**
132
- * Configures the library with a partial or complete
133
- * `RelicoConfig`. Invalid fields are ignored.
134
- */
135
- export declare function configure(userInput: unknown): void;
136
- /**
137
- * Returns a color function by name (or `reset` or identity if not found).
138
- * Uses cached functions for better performance.
139
- */
140
- /**
141
- * Colorizes text with a color function.
142
- */
143
- /**
144
- * Sets the color level (0=none, 1=basic, 2=256, 3=truecolor).
145
- */
146
- export declare function setColorLevel(level: 0 | 1 | 2 | 3): void;
147
- /**
148
- * Returns a custom "rgb" color function if level is truecolor, otherwise identity.
149
- * Uses caching for better performance.
150
- * @param r Red component (0-255)
151
- * @param g Green component (0-255)
152
- * @param b Blue component (0-255)
153
- */
154
- export declare function rgb(r: number, g: number, b: number): (text: string | number) => string;
155
- /**
156
- * Returns a custom background "bgRgb" color function.
157
- * Uses caching for better performance.
158
- * @param r Red component (0-255)
159
- * @param g Green component (0-255)
160
- * @param b Blue component (0-255)
161
- */
162
- export declare function bgRgb(r: number, g: number, b: number): (text: string | number) => string;
163
- /**
164
- * Creates a color function from a hex string or color name
165
- * @param color Hex string (e.g., "#ff0000") or color name (e.g., "red")
166
- */
167
- export declare function hex(color: string): (text: string | number) => string;
168
- /**
169
- * Creates a background color function from a hex string or color name
170
- * @param color Hex string (e.g., "#ff0000") or color name (e.g., "red")
171
- */
172
- export declare function bgHex(color: string): (text: string | number) => string;
173
- /**
174
- * Creates an HSL color from hue, saturation, and lightness values
175
- * @param h Hue (0-360)
176
- * @param s Saturation (0-100)
177
- * @param l Lightness (0-100)
178
- */
179
- export declare function hsl(h: number, s: number, l: number): (text: string | number) => string;
180
- /**
181
- * Creates a background HSL color
182
- * @param h Hue (0-360)
183
- * @param s Saturation (0-100)
184
- * @param l Lightness (0-100)
185
- */
186
- export declare function bgHsl(h: number, s: number, l: number): (text: string | number) => string;
187
- /**
188
- * Chain multiple color formatters together
189
- * @param formatters Array of color formatters to apply in sequence
190
- */
191
- export declare function chain(...formatters: ((text: string | number) => string)[]): (text: string | number) => string;
192
- /**
193
- * Creates a rainbow text effect
194
- * @param text The text to colorize
195
- * @param saturation Saturation (0-100)
196
- * @param lightness Lightness (0-100)
197
- * @param options Additional options
198
- * @returns The rainbow-colorized text
199
- */
200
- export declare function rainbow(text: string, saturation?: number, lightness?: number, options?: {
201
- startHue?: number;
202
- endHue?: number;
203
- }): string;
204
- /**
205
- * Creates a gradient text effect between multiple colors
206
- * @param text The text to colorize
207
- * @param colors Array of colors (hex, rgb, hsl, or named colors)
208
- * @param options Additional options (smoothing, distribution)
209
- * @returns The gradient-colorized text
210
- */
211
- export declare function multiGradient(text: string, colors: string[], options?: {
212
- smoothing?: number;
213
- distribution?: "even" | "weighted";
214
- }): string;
215
- /**
216
- * Creates a gradient text effect between two colors
217
- * @param text The text to colorize
218
- * @param startColor Starting color (hex, rgb, hsl, or named color)
219
- * @param endColor Ending color (hex, rgb, hsl, or named color)
220
- * @param options Additional options (smoothing)
221
- * @returns The gradient-colorized text
222
- */
223
- export declare function gradient(text: string, startColor: string, endColor: string, options?: {
224
- smoothing?: number;
225
- }): string;
226
- /**
227
- * Blend two colors together with a given ratio
228
- * @param color1 First color
229
- * @param color2 Second color
230
- * @param ratio Blend ratio (0-1, 0 = color1, 1 = color2)
231
- * @returns A formatter function with the blended color
232
- */
233
- export declare function blend(color1: string, color2: string, ratio?: number): (text: string | number) => string;
234
- /**
235
- * Checks if a color meets WCAG contrast guidelines against another color
236
- * @param foreground Foreground color
237
- * @param background Background color (defaults to white)
238
- * @returns Object with contrast ratio and pass/fail for AA and AAA levels
239
- */
240
- export declare function checkContrast(foreground: string, background?: string): {
241
- ratio: number;
242
- passesAA: boolean;
243
- passesAAA: boolean;
244
- passesAALarge: boolean;
245
- passesAAALarge: boolean;
31
+ type ApplyInput = string | number;
32
+ type FormatCallable = ((input: ApplyInput) => string) & {
33
+ readonly [OP_SYMBOL]: SgrOp[];
246
34
  };
247
- /**
248
- * Find an accessible color by adjusting lightness until it meets contrast requirements
249
- * @param color Base color to adjust
250
- * @param background Background color to check contrast against
251
- * @param targetRatio Minimum contrast ratio to achieve (4.5 = AA, 7 = AAA)
252
- * @returns A color with sufficient contrast
253
- */
254
- export declare function getAccessibleColor(color: string, background?: string, targetRatio?: number): string;
255
- export type ColorSupport = {
256
- isColorSupported: boolean;
257
- isForced: boolean;
258
- isDisabled: boolean;
259
- terminalName: string;
260
- colorLevel: 0 | 1 | 2 | 3;
35
+ type BaseColorName = "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "orange" | "pink" | "purple" | "teal" | "lime" | "brown" | "navy" | "maroon" | "olive" | "silver";
36
+ type ColorName = BaseColorName | GrayScaleName | BrightColorName | PastelColorName | BgColorName;
37
+ type GrayScaleName = "gray10" | "gray20" | "gray30" | "gray40" | "gray50" | "gray60" | "gray70" | "gray80" | "gray90";
38
+ type BrightColorName = "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright" | "orangeBright" | "pinkBright" | "purpleBright" | "tealBright" | "limeBright" | "brownBright" | "navyBright" | "maroonBright" | "oliveBright" | "silverBright";
39
+ type PastelColorName = "blackPastel" | "redPastel" | "greenPastel" | "yellowPastel" | "bluePastel" | "magentaPastel" | "cyanPastel" | "whitePastel" | "grayPastel" | "orangePastel" | "pinkPastel" | "purplePastel" | "tealPastel" | "limePastel" | "brownPastel" | "navyPastel" | "maroonPastel" | "olivePastel" | "silverPastel";
40
+ type BgColorName = `bg${Capitalize<BaseColorName>}` | `bg${Capitalize<GrayScaleName>}` | `bg${Capitalize<BrightColorName>}` | `bg${Capitalize<PastelColorName>}`;
41
+ type MkRgbFn = (r: number, g: number, b: number) => Re;
42
+ type MkHexFn = (hex: string) => Re;
43
+ type MkHslFn = (h: number, s: number, l: number) => Re;
44
+ type StyleKeys = "reset" | "bold" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough";
45
+ type Re = FormatCallable & {
46
+ readonly [K in StyleKeys]: Re;
47
+ } & {
48
+ readonly [K in ColorName]: Re;
49
+ } & {
50
+ readonly [K in BgColorName]: Re;
51
+ } & {
52
+ readonly rgb: MkRgbFn;
53
+ readonly hex: MkHexFn;
54
+ readonly hsl: MkHslFn;
55
+ readonly bgRgb: MkRgbFn;
56
+ readonly bgHex: MkHexFn;
57
+ readonly bgHsl: MkHslFn;
261
58
  };
262
- export declare const colorSupport: ColorSupport;
263
- /**
264
- * Creates a safe background color wrapping that prevents spillover to new lines
265
- * @param text The text to colorize
266
- * @param bgColorFn Background color formatter function
267
- * @param textColorFn Optional text color formatter function
268
- * @returns Safely wrapped colored text
269
- */
270
- export declare function colorWrap(text: string, bgColorFn: (text: string | number) => string, textColorFn?: (text: string | number) => string): string;
271
- /**
272
- * Smart background color function that prevents background color overflow
273
- * Apply background color to text while ensuring it doesn't spill over to new lines
274
- * @param color Background color (hex, named, etc.)
275
- * @param text Optional text to colorize immediately
276
- */
277
- export declare function safeBg(color: string, text?: string | number): ((text: string | number) => string) | string;
278
- /**
279
- * Apply background and foreground colors while preventing spillover
280
- * @param bgColor Background color
281
- * @param fgColor Foreground color
282
- * @param text Optional text to colorize immediately
283
- */
284
- export declare function safeColor(bgColor: string, fgColor: string, text?: string | number): ((text: string | number) => string) | string;
285
- /**
286
- * Creates a color function that automatically ensures good contrast
287
- * @param color Base color to use
288
- * @param background Background color to check contrast against
289
- * @param targetRatio Minimum contrast ratio to achieve (4.5 = AA, 7 = AAA)
290
- */
291
- export declare function autoContrast(color: string, background?: string, targetRatio?: number): (text: string | number) => string;
292
- /**
293
- * Creates a color scheme from a base color
294
- * @param baseColor The main color to generate a scheme from
295
- * @returns Object with various related colors
296
- */
297
- export declare function createColorScheme(baseColor: string): {
298
- base: (text: string | number) => string;
299
- light: (text: string | number) => string;
300
- dark: (text: string | number) => string;
301
- bright: (text: string | number) => string;
302
- pastel: (text: string | number) => string;
303
- bg: (text: string | number) => string;
304
- bgLight: (text: string | number) => string;
305
- accent: (text: string | number) => string;
306
- };
307
- /**
308
- * Creates a highlighted text with colored background and contrasting text
309
- * @param text Text to highlight
310
- * @param bgColor Background color
311
- * @param options Additional options
312
- */
313
- export declare function highlight(text: string, bgColor: string, options?: {
314
- padding?: number;
315
- border?: boolean;
316
- borderColor?: string;
317
- }): string;
318
- /**
319
- * Creates an ANSI link (works in supported terminals)
320
- * @param text Link text to display
321
- * @param url The URL to link to
322
- * @param color Optional color for the link text
323
- */
324
- export declare function link(text: string, url: string, color?: string): string;
325
- /**
326
- * Colorize a JSON object with syntax highlighting
327
- * @param obj Object to stringify and colorize
328
- * @param options Options for JSON stringification
329
- */
330
- export declare function colorizeJson(obj: unknown, options?: {
331
- indent?: number;
332
- compact?: boolean;
333
- }): string;
334
- /**
335
- * Initialize user configuration with optional programmatic overrides
336
- * @param programmaticConfig Optional configuration to override settings
337
- * @param userSettingsPrecedence If true, user file settings take precedence over programmatic
338
- */
339
- export declare function initUserConfig(programmaticConfig?: Partial<RelicoConfig>, userSettingsPrecedence?: boolean): Promise<void>;
340
- /**
341
- * Provides type safety and IntelliSense for user configuration.
342
- * Example usage in `relico.config.ts`:
343
- * ```ts
344
- * import { defineConfig } from "@reliverse/relico-cfg";
345
- * export default defineConfig({
346
- * colorLevel: 3,
347
- * theme: "secondary",
348
- * customColors: {
349
- * red: ["#f00", "#c00"],
350
- * blue: ["#0af", "#08f"],
351
- * green: ["#00ff00", "#00cc00"],
352
- * },
353
- * });
354
- * ```
355
- */
356
- export declare function defineConfig(cfg: RelicoConfig): RelicoConfig;
59
+ declare const OP_SYMBOL: unique symbol;
60
+ export declare const setColorLevel: (level: ColorLevel) => void;
61
+ export declare const re: Re;
62
+ export declare const rgb: MkRgbFn;
63
+ export declare const hex: MkHexFn;
64
+ export declare const hsl: MkHslFn;
65
+ export declare const bgRgb: MkRgbFn;
66
+ export declare const bgHex: MkHexFn;
67
+ export declare const bgHsl: MkHslFn;
68
+ export declare const chain: (...parts: FormatCallable[]) => Re;
69
+ export declare const parseRgb: (value: string) => Rgb | null;
70
+ export declare const parseHsl: (value: string) => {
71
+ h: number;
72
+ s: number;
73
+ l: number;
74
+ } | null;
357
75
  export {};