@reliverse/relico 1.1.2 → 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,22 +4,22 @@
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
- <img src="example.png" width="50%" alt="Available Relico colors" />
22
+ <img src="./example/example.png" width="50%" alt="Available Relico colors" />
23
23
 
24
24
  ## Installation
25
25
 
@@ -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**:
@@ -62,11 +120,10 @@ console.log(re.info("Custom config loaded!"));
62
120
  ## API Sneak Peek
63
121
 
64
122
  ```ts
65
- import { re, colorize, rgb } from "@reliverse/relico";
123
+ import { re, rgb } from "@reliverse/relico";
66
124
 
67
125
  console.log(re.red("Red!"));
68
126
  console.log(re.bold(re.green("Bold green")));
69
- console.log(colorize("magenta", "Hello!"));
70
127
 
71
128
  console.log(rgb(250, 128, 114)("This is salmon"));
72
129
  ```
@@ -120,7 +177,7 @@ const brandColors: DefaultColorKeys[] = ["magentaBright", "maroon"];
120
177
 
121
178
  ## Color Detection
122
179
 
123
- Relico detects your terminals capability:
180
+ Relico detects your terminal's capability:
124
181
 
125
182
  ```ts
126
183
  import { colorSupport } from "@reliverse/relico";
@@ -275,7 +332,7 @@ bun i
275
332
  bun dev
276
333
  ```
277
334
 
278
- Check `examples/e-mod.ts` for all the fun.
335
+ Check `example/e-mod.ts` for all the fun.
279
336
 
280
337
  ## Use Cases
281
338
 
@@ -294,7 +351,7 @@ Relico draws inspiration from all — and goes beyond them with modern configs,
294
351
 
295
352
  ## 🛠 Contributing
296
353
 
297
- Wed love your help! Bug? Feature? Example? PR it!
354
+ We'd love your help! Bug? Feature? Example? PR it!
298
355
  Or hop into [Discord](https://discord.gg/Pb8uKbwpsJ) to discuss CLI theming and terminal art 💜
299
356
 
300
357
  ```bash
package/bin/mod.d.ts CHANGED
@@ -1,364 +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
- export declare function getColor(name: string): (text: string | number) => string;
141
- /**
142
- * Colorizes text with a color function.
143
- */
144
- export declare function colorize(name: string, text: string | number): string;
145
- /**
146
- * Sets the color level (0=none, 1=basic, 2=256, 3=truecolor).
147
- */
148
- export declare function setColorLevel(level: 0 | 1 | 2 | 3): void;
149
- /**
150
- * Returns a custom "rgb" color function if level is truecolor, otherwise identity.
151
- * Uses caching for better performance.
152
- * @param r Red component (0-255)
153
- * @param g Green component (0-255)
154
- * @param b Blue component (0-255)
155
- */
156
- export declare function rgb(r: number, g: number, b: number): (text: string | number) => string;
157
- /**
158
- * Returns a custom background "bgRgb" color function.
159
- * Uses caching for better performance.
160
- * @param r Red component (0-255)
161
- * @param g Green component (0-255)
162
- * @param b Blue component (0-255)
163
- */
164
- export declare function bgRgb(r: number, g: number, b: number): (text: string | number) => string;
165
- /**
166
- * Creates a color function from a hex string or color name
167
- * @param color Hex string (e.g., "#ff0000") or color name (e.g., "red")
168
- */
169
- export declare function hex(color: string): (text: string | number) => string;
170
- /**
171
- * Creates a background color function from a hex string or color name
172
- * @param color Hex string (e.g., "#ff0000") or color name (e.g., "red")
173
- */
174
- export declare function bgHex(color: string): (text: string | number) => string;
175
- /**
176
- * Creates an HSL color from hue, saturation, and lightness values
177
- * @param h Hue (0-360)
178
- * @param s Saturation (0-100)
179
- * @param l Lightness (0-100)
180
- */
181
- export declare function hsl(h: number, s: number, l: number): (text: string | number) => string;
182
- /**
183
- * Creates a background HSL color
184
- * @param h Hue (0-360)
185
- * @param s Saturation (0-100)
186
- * @param l Lightness (0-100)
187
- */
188
- export declare function bgHsl(h: number, s: number, l: number): (text: string | number) => string;
189
- /**
190
- * Chain multiple color formatters together
191
- * @param formatters Array of color formatters to apply in sequence
192
- */
193
- export declare function chain(...formatters: ((text: string | number) => string)[]): (text: string | number) => string;
194
- /**
195
- * Creates a rainbow text effect
196
- * @param text The text to colorize
197
- * @param saturation Saturation (0-100)
198
- * @param lightness Lightness (0-100)
199
- * @param options Additional options
200
- * @returns The rainbow-colorized text
201
- */
202
- export declare function rainbow(text: string, saturation?: number, lightness?: number, options?: {
203
- startHue?: number;
204
- endHue?: number;
205
- }): string;
206
- /**
207
- * Creates a gradient text effect between multiple colors
208
- * @param text The text to colorize
209
- * @param colors Array of colors (hex, rgb, hsl, or named colors)
210
- * @param options Additional options (smoothing, distribution)
211
- * @returns The gradient-colorized text
212
- */
213
- export declare function multiGradient(text: string, colors: string[], options?: {
214
- smoothing?: number;
215
- distribution?: "even" | "weighted";
216
- }): string;
217
- /**
218
- * Creates a gradient text effect between two colors
219
- * @param text The text to colorize
220
- * @param startColor Starting color (hex, rgb, hsl, or named color)
221
- * @param endColor Ending color (hex, rgb, hsl, or named color)
222
- * @param options Additional options (smoothing)
223
- * @returns The gradient-colorized text
224
- */
225
- export declare function gradient(text: string, startColor: string, endColor: string, options?: {
226
- smoothing?: number;
227
- }): string;
228
- /**
229
- * Blend two colors together with a given ratio
230
- * @param color1 First color
231
- * @param color2 Second color
232
- * @param ratio Blend ratio (0-1, 0 = color1, 1 = color2)
233
- * @returns A formatter function with the blended color
234
- */
235
- export declare function blend(color1: string, color2: string, ratio?: number): (text: string | number) => string;
236
- /**
237
- * Checks if a color meets WCAG contrast guidelines against another color
238
- * @param foreground Foreground color
239
- * @param background Background color (defaults to white)
240
- * @returns Object with contrast ratio and pass/fail for AA and AAA levels
241
- */
242
- export declare function checkContrast(foreground: string, background?: string): {
243
- ratio: number;
244
- passesAA: boolean;
245
- passesAAA: boolean;
246
- passesAALarge: boolean;
247
- passesAAALarge: boolean;
31
+ type ApplyInput = string | number;
32
+ type FormatCallable = ((input: ApplyInput) => string) & {
33
+ readonly [OP_SYMBOL]: SgrOp[];
248
34
  };
249
- /**
250
- * Find an accessible color by adjusting lightness until it meets contrast requirements
251
- * @param color Base color to adjust
252
- * @param background Background color to check contrast against
253
- * @param targetRatio Minimum contrast ratio to achieve (4.5 = AA, 7 = AAA)
254
- * @returns A color with sufficient contrast
255
- */
256
- export declare function getAccessibleColor(color: string, background?: string, targetRatio?: number): string;
257
- export type ColorSupport = {
258
- isColorSupported: boolean;
259
- isForced: boolean;
260
- isDisabled: boolean;
261
- terminalName: string;
262
- 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;
263
58
  };
264
- export declare const colorSupport: ColorSupport;
265
- /**
266
- * Creates a safe background color wrapping that prevents spillover to new lines
267
- * @param text The text to colorize
268
- * @param bgColorFn Background color formatter function
269
- * @param textColorFn Optional text color formatter function
270
- * @returns Safely wrapped colored text
271
- */
272
- export declare function colorWrap(text: string, bgColorFn: (text: string | number) => string, textColorFn?: (text: string | number) => string): string;
273
- /**
274
- * Smart background color function that prevents background color overflow
275
- * Apply background color to text while ensuring it doesn't spill over to new lines
276
- * @param color Background color (hex, named, etc.)
277
- * @param text Optional text to colorize immediately
278
- */
279
- export declare function safeBg(color: string, text?: string | number): ((text: string | number) => string) | string;
280
- /**
281
- * Apply background and foreground colors while preventing spillover
282
- * @param bgColor Background color
283
- * @param fgColor Foreground color
284
- * @param text Optional text to colorize immediately
285
- */
286
- export declare function safeColor(bgColor: string, fgColor: string, text?: string | number): ((text: string | number) => string) | string;
287
- /**
288
- * Creates a color function that automatically ensures good contrast
289
- * @param color Base color to use
290
- * @param background Background color to check contrast against
291
- * @param targetRatio Minimum contrast ratio to achieve (4.5 = AA, 7 = AAA)
292
- */
293
- export declare function autoContrast(color: string, background?: string, targetRatio?: number): (text: string | number) => string;
294
- /**
295
- * Creates a color scheme from a base color
296
- * @param baseColor The main color to generate a scheme from
297
- * @returns Object with various related colors
298
- */
299
- export declare function createColorScheme(baseColor: string): {
300
- base: (text: string | number) => string;
301
- light: (text: string | number) => string;
302
- dark: (text: string | number) => string;
303
- bright: (text: string | number) => string;
304
- pastel: (text: string | number) => string;
305
- bg: (text: string | number) => string;
306
- bgLight: (text: string | number) => string;
307
- accent: (text: string | number) => string;
308
- };
309
- /**
310
- * Creates a highlighted text with colored background and contrasting text
311
- * @param text Text to highlight
312
- * @param bgColor Background color
313
- * @param options Additional options
314
- */
315
- export declare function highlight(text: string, bgColor: string, options?: {
316
- padding?: number;
317
- border?: boolean;
318
- borderColor?: string;
319
- }): string;
320
- /**
321
- * Creates an ANSI link (works in supported terminals)
322
- * @param text Link text to display
323
- * @param url The URL to link to
324
- * @param color Optional color for the link text
325
- */
326
- export declare function link(text: string, url: string, color?: string): string;
327
- /**
328
- * Colorize a JSON object with syntax highlighting
329
- * @param obj Object to stringify and colorize
330
- * @param options Options for JSON stringification
331
- */
332
- export declare function colorizeJson(obj: unknown, options?: {
333
- indent?: number;
334
- compact?: boolean;
335
- }): string;
336
- /**
337
- * Initialize user configuration with optional programmatic overrides
338
- * @param programmaticConfig Optional configuration to override default settings
339
- * @param userSettingsPrecedence If true, user file settings take precedence over programmatic
340
- */
341
- /**
342
- * Initialize user configuration with optional programmatic overrides
343
- * @param programmaticConfig Optional configuration to override settings
344
- * @param userSettingsPrecedence If true, user file settings take precedence over programmatic
345
- */
346
- export declare function initUserConfig(programmaticConfig?: Partial<RelicoConfig>, userSettingsPrecedence?: boolean): Promise<void>;
347
- /**
348
- * Provides type safety and IntelliSense for user configuration.
349
- * Example usage in `relico.config.ts`:
350
- * ```ts
351
- * import { defineConfig } from "@reliverse/relico-cfg";
352
- * export default defineConfig({
353
- * colorLevel: 3,
354
- * theme: "secondary",
355
- * customColors: {
356
- * red: ["#f00", "#c00"],
357
- * blue: ["#0af", "#08f"],
358
- * green: ["#00ff00", "#00cc00"],
359
- * },
360
- * });
361
- * ```
362
- */
363
- 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;
364
75
  export {};