chalk-ts 1.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Noor Mohammad
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,502 @@
1
+ # ๐ŸŽจ chalk-ts
2
+
3
+ <div align="center">
4
+ <img src="https://res.cloudinary.com/duehd78sl/image/upload/v1755416064/npm-packages/chalk_z6fjpf.jpg" alt="chalk-ts Logo" width="400" />
5
+ </div>
6
+
7
+ <div align="center">
8
+
9
+ [![npm version](https://badge.fury.io/js/chalk-ts.svg)](https://badge.fury.io/js/chalk-ts)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
12
+ [![Test Coverage](https://img.shields.io/badge/coverage-95%25-brightgreen.svg)](https://github.com/noorjsdivs/chalk-ts)
13
+ [![YouTube](https://img.shields.io/badge/YouTube-ReactJS%20BD-red.svg?logo=youtube)](https://www.youtube.com/@reactjsBD)
14
+ [![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-Support-orange.svg?logo=buy-me-a-coffee)](https://buymeacoffee.com/reactbd)
15
+
16
+ </div>
17
+
18
+ > ๐Ÿš€ **Modern terminal string styling library built with TypeScript**
19
+ > A powerful, feature-rich alternative to chalk with enhanced capabilities, better performance, and modern development experience.
20
+
21
+ ## โœจ Features
22
+
23
+ - ๐ŸŽจ **Rich Color Support**: 20+ built-in colors, RGB, HEX, HSL support
24
+ - ๐ŸŽญ **Advanced Effects**: Gradient, rainbow, pulse, neon, shadow effects
25
+ - ๐Ÿ› ๏ธ **Built-in Utilities**: Tables, progress bars, boxes, spinners
26
+ - ๐Ÿ”’ **TypeScript First**: Full type safety with excellent IntelliSense
27
+ - ๐Ÿ“ฆ **Zero Dependencies**: No external packages, minimal bundle size
28
+ - ๐ŸŒณ **Tree Shakeable**: Import only what you need
29
+ - โšก **High Performance**: Optimized for speed and efficiency
30
+ - ๐Ÿ”ง **Easy Migration**: Drop-in replacement for most chalk usage
31
+ - ๐Ÿ“– **Comprehensive Docs**: Extensive documentation and examples
32
+ - ๐Ÿงช **Well Tested**: 95%+ test coverage
33
+
34
+ ## ๐Ÿ“ฆ Installation
35
+
36
+ ```bash
37
+ npm install chalk-ts
38
+ ```
39
+
40
+ ```bash
41
+ yarn add chalk-ts
42
+ ```
43
+
44
+ ```bash
45
+ pnpm add chalk-ts
46
+ ```
47
+
48
+ ## ๐Ÿš€ Quick Start
49
+
50
+ ```typescript
51
+ import chalkTs from "chalk-ts";
52
+
53
+ // Basic colors
54
+ console.log(chalkTs.red("Hello World!"));
55
+ console.log(chalkTs.green.bold("Success message"));
56
+
57
+ // Advanced colors
58
+ console.log(chalkTs.rgb(255, 136, 0)("Custom RGB color"));
59
+ console.log(chalkTs.hex("#ff8800")("HEX color"));
60
+ console.log(chalkTs.hsl(30, 100, 50)("HSL color"));
61
+
62
+ // Method chaining
63
+ console.log(chalkTs.bold.red.bgYellow("Styled text"));
64
+
65
+ // Advanced effects
66
+ import { gradient, rainbow, box } from "chalk-ts";
67
+
68
+ console.log(gradient("Gradient text!", "#ff0000", "#0000ff"));
69
+ console.log(rainbow("Rainbow colors!"));
70
+ console.log(box("Boxed text"));
71
+ ```
72
+
73
+ ## ๐ŸŽจ Basic Styling
74
+
75
+ ### Text Styles
76
+
77
+ ```typescript
78
+ import chalkTs from "chalk-ts";
79
+
80
+ console.log(chalkTs.bold("Bold text"));
81
+ console.log(chalkTs.italic("Italic text"));
82
+ console.log(chalkTs.underline("Underlined text"));
83
+ console.log(chalkTs.strikethrough("Strikethrough text"));
84
+ console.log(chalkTs.dim("Dimmed text"));
85
+ console.log(chalkTs.inverse("Inverted text"));
86
+ ```
87
+
88
+ ### Basic Colors
89
+
90
+ ```typescript
91
+ // Foreground colors
92
+ console.log(chalkTs.red("Red text"));
93
+ console.log(chalkTs.green("Green text"));
94
+ console.log(chalkTs.blue("Blue text"));
95
+ console.log(chalkTs.yellow("Yellow text"));
96
+ console.log(chalkTs.magenta("Magenta text"));
97
+ console.log(chalkTs.cyan("Cyan text"));
98
+ console.log(chalkTs.white("White text"));
99
+ console.log(chalkTs.gray("Gray text"));
100
+
101
+ // Background colors
102
+ console.log(chalkTs.bgRed("Red background"));
103
+ console.log(chalkTs.bgGreen("Green background"));
104
+ console.log(chalkTs.bgBlue("Blue background"));
105
+
106
+ // Bright colors
107
+ console.log(chalkTs.redBright("Bright red"));
108
+ console.log(chalkTs.greenBright("Bright green"));
109
+ console.log(chalkTs.blueBright("Bright blue"));
110
+ ```
111
+
112
+ ### Extended Color Palette
113
+
114
+ chalk-ts includes 20+ built-in colors beyond the standard ANSI colors:
115
+
116
+ ```typescript
117
+ console.log(chalkTs.orange("Orange text"));
118
+ console.log(chalkTs.purple("Purple text"));
119
+ console.log(chalkTs.pink("Pink text"));
120
+ console.log(chalkTs.brown("Brown text"));
121
+ console.log(chalkTs.lime("Lime text"));
122
+ console.log(chalkTs.indigo("Indigo text"));
123
+ console.log(chalkTs.violet("Violet text"));
124
+ console.log(chalkTs.turquoise("Turquoise text"));
125
+ console.log(chalkTs.gold("Gold text"));
126
+ console.log(chalkTs.silver("Silver text"));
127
+ ```
128
+
129
+ ## ๐ŸŒˆ Advanced Colors
130
+
131
+ ### RGB Colors
132
+
133
+ ```typescript
134
+ // Foreground RGB
135
+ console.log(chalkTs.rgb(255, 136, 0)("Orange RGB"));
136
+
137
+ // Background RGB
138
+ console.log(chalkTs.bgRgb(255, 136, 0)("Orange background"));
139
+ ```
140
+
141
+ ### HEX Colors
142
+
143
+ ```typescript
144
+ // Foreground HEX
145
+ console.log(chalkTs.hex("#ff8800")("Orange HEX"));
146
+
147
+ // Background HEX
148
+ console.log(chalkTs.bgHex("#ff8800")("Orange background"));
149
+ ```
150
+
151
+ ### HSL Colors
152
+
153
+ ```typescript
154
+ // Foreground HSL
155
+ console.log(chalkTs.hsl(30, 100, 50)("Orange HSL"));
156
+
157
+ // Background HSL
158
+ console.log(chalkTs.bgHsl(30, 100, 50)("Orange background"));
159
+ ```
160
+
161
+ ## ๐ŸŽญ Advanced Effects
162
+
163
+ ### Gradient
164
+
165
+ Create beautiful gradient effects between two colors:
166
+
167
+ ```typescript
168
+ import { gradient } from "chalk-ts";
169
+
170
+ console.log(gradient("Gradient Text!", "#ff0000", "#0000ff"));
171
+ console.log(gradient("Fire Effect", "#ff4500", "#ffd700"));
172
+ ```
173
+
174
+ ### Rainbow
175
+
176
+ Apply rainbow colors to text:
177
+
178
+ ```typescript
179
+ import { rainbow } from "chalk-ts";
180
+
181
+ console.log(rainbow("Rainbow Colors!"));
182
+ console.log(rainbow("๐ŸŒˆ Colorful text ๐ŸŒˆ"));
183
+ ```
184
+
185
+ ### Pulse
186
+
187
+ Create pulsing effects with alternating bright and dim:
188
+
189
+ ```typescript
190
+ import { pulse } from "chalk-ts";
191
+
192
+ console.log(pulse("Pulsing text", "red"));
193
+ console.log(pulse("Attention!", "yellow"));
194
+ ```
195
+
196
+ ### Zebra Stripes
197
+
198
+ Alternate between two colors:
199
+
200
+ ```typescript
201
+ import { zebra } from "chalk-ts";
202
+
203
+ console.log(zebra("Zebra effect", "red", "blue"));
204
+ console.log(zebra("Alternating!", "green", "yellow"));
205
+ ```
206
+
207
+ ### Neon Effect
208
+
209
+ Create glowing neon-style text:
210
+
211
+ ```typescript
212
+ import { neon } from "chalk-ts";
213
+
214
+ console.log(neon("Neon text!", "cyan"));
215
+ console.log(neon("Glowing!", "magenta"));
216
+ ```
217
+
218
+ ### Shadow Effect
219
+
220
+ Add shadow to text:
221
+
222
+ ```typescript
223
+ import { shadow } from "chalk-ts";
224
+
225
+ console.log(shadow("Text with shadow", "cyan", "gray"));
226
+ ```
227
+
228
+ ## ๐Ÿ› ๏ธ Built-in Utilities
229
+
230
+ ### Boxes
231
+
232
+ Create beautiful boxes around text:
233
+
234
+ ```typescript
235
+ import { box } from "chalk-ts";
236
+
237
+ // Simple box
238
+ console.log(box("Hello World!"));
239
+
240
+ // Customized box
241
+ console.log(
242
+ box("Fancy Box", {
243
+ padding: 2,
244
+ color: "cyan",
245
+ style: "double",
246
+ })
247
+ );
248
+
249
+ // Different styles: 'single', 'double', 'rounded', 'thick'
250
+ console.log(box("Rounded", { style: "rounded" }));
251
+ ```
252
+
253
+ ### Progress Bars
254
+
255
+ Create progress indicators:
256
+
257
+ ```typescript
258
+ import { progressBar } from "chalk-ts";
259
+
260
+ console.log(progressBar(75, 100)); // 75% progress
261
+ console.log(
262
+ progressBar(50, 100, {
263
+ width: 30,
264
+ complete: "โ– ",
265
+ incomplete: "โ–ก",
266
+ color: "green",
267
+ })
268
+ );
269
+ ```
270
+
271
+ ### Tables
272
+
273
+ Create formatted tables:
274
+
275
+ ```typescript
276
+ import { table } from "chalk-ts";
277
+
278
+ const data = [
279
+ ["John", "25", "Engineer"],
280
+ ["Jane", "30", "Designer"],
281
+ ["Bob", "35", "Manager"],
282
+ ];
283
+
284
+ const headers = ["Name", "Age", "Role"];
285
+
286
+ console.log(
287
+ table(data, {
288
+ headers,
289
+ headerColor: "cyan",
290
+ borderColor: "gray",
291
+ })
292
+ );
293
+ ```
294
+
295
+ ### Spinners
296
+
297
+ Animated loading indicators:
298
+
299
+ ```typescript
300
+ import { spinner } from "chalk-ts";
301
+
302
+ // Display different frames
303
+ for (let i = 0; i < 10; i++) {
304
+ console.log(spinner(i, "cyan"));
305
+ }
306
+ ```
307
+
308
+ ## ๐Ÿ”— Method Chaining
309
+
310
+ chalk-ts supports full method chaining for complex styling:
311
+
312
+ ```typescript
313
+ // Combine multiple styles
314
+ console.log(chalkTs.bold.red.bgYellow("Complex styling"));
315
+
316
+ // Chain with custom colors
317
+ console.log(chalkTs.bold.rgb(255, 100, 0).bgHex("#000000")("Custom chain"));
318
+
319
+ // Multiple text effects
320
+ console.log(chalkTs.bold.italic.underline.red("All effects"));
321
+ ```
322
+
323
+ ## ๐Ÿ”ง Utilities
324
+
325
+ ### Strip ANSI Codes
326
+
327
+ Remove styling from text:
328
+
329
+ ```typescript
330
+ const styled = chalkTs.red.bold("Styled text");
331
+ const plain = chalkTs.strip(styled);
332
+ console.log(plain); // 'Styled text'
333
+ ```
334
+
335
+ ### Calculate Length
336
+
337
+ Get the actual text length without ANSI codes:
338
+
339
+ ```typescript
340
+ const styled = chalkTs.red.bold("Hello");
341
+ console.log(styled.length); // Includes ANSI codes
342
+ console.log(chalkTs.length(styled)); // 5 (actual text length)
343
+ ```
344
+
345
+ ### Template Literals
346
+
347
+ Support for template strings:
348
+
349
+ ```typescript
350
+ const name = "World";
351
+ console.log(chalkTs.template`Hello ${chalkTs.red(name)}!`);
352
+ ```
353
+
354
+ ### Color Detection
355
+
356
+ Control color output:
357
+
358
+ ```typescript
359
+ import { ChalkTS } from "chalk-ts";
360
+
361
+ // Force disable colors
362
+ const noColors = new ChalkTS(false);
363
+ console.log(noColors.red("Plain text"));
364
+
365
+ // Force enable colors
366
+ const withColors = new ChalkTS(true);
367
+ console.log(withColors.red("Red text"));
368
+ ```
369
+
370
+ ## ๐Ÿ“Š Performance Comparison
371
+
372
+ chalk-ts is designed for performance while providing more features:
373
+
374
+ | Library | Bundle Size | Features | Performance | TypeScript |
375
+ | --------- | ----------- | ---------- | ----------- | ---------- |
376
+ | chalk-ts | ~15KB | โญโญโญโญโญ | โญโญโญโญโญ | โญโญโญโญโญ |
377
+ | Chalk | ~17KB | โญโญโญ | โญโญโญโญ | โญโญโญโญ |
378
+ | Colorette | ~8KB | โญโญ | โญโญโญโญโญ | โญโญโญ |
379
+
380
+ ### Why Choose chalk-ts?
381
+
382
+ 1. **๐ŸŽจ More Colors**: 20+ built-in colors vs 8 in most libraries
383
+ 2. **๐ŸŽญ More Effects**: Gradient, rainbow, pulse, neon, and more
384
+ 3. **๐Ÿ› ๏ธ More Utilities**: Tables, progress bars, boxes, spinners
385
+ 4. **๐Ÿ”’ Better Types**: Full TypeScript support with strict typing
386
+ 5. **๐Ÿ“ฆ Modern Build**: ES modules, tree-shaking, zero dependencies
387
+ 6. **๐Ÿงช Well Tested**: 95%+ test coverage
388
+ 7. **๐Ÿ“– Great Docs**: Comprehensive documentation
389
+ 8. **๐Ÿ”ง Easy Migration**: Drop-in replacement for chalk
390
+
391
+ ## ๐Ÿ”„ Migration from Chalk
392
+
393
+ chalk-ts is designed as a drop-in replacement for chalk:
394
+
395
+ ```typescript
396
+ // Before (chalk)
397
+ import chalk from "chalk";
398
+ console.log(chalk.red.bold("Hello"));
399
+
400
+ // After (chalk-ts)
401
+ import chalkTs from "chalk-ts";
402
+ console.log(chalkTs.red.bold("Hello"));
403
+ ```
404
+
405
+ Most chalk code will work without changes, but you'll get additional features and better TypeScript support.
406
+
407
+ ## ๐Ÿ“š API Reference
408
+
409
+ ### Basic Colors
410
+
411
+ - `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`, `gray`
412
+ - `redBright`, `greenBright`, `yellowBright`, `blueBright`, `magentaBright`, `cyanBright`, `whiteBright`
413
+
414
+ ### Background Colors
415
+
416
+ - `bgBlack`, `bgRed`, `bgGreen`, `bgYellow`, `bgBlue`, `bgMagenta`, `bgCyan`, `bgWhite`, `bgGray`
417
+ - `bgRedBright`, `bgGreenBright`, `bgYellowBright`, `bgBlueBright`, `bgMagentaBright`, `bgCyanBright`, `bgWhiteBright`
418
+
419
+ ### Extended Colors
420
+
421
+ - `orange`, `purple`, `pink`, `brown`, `lime`, `indigo`, `violet`, `turquoise`, `gold`, `silver`
422
+
423
+ ### Text Styles
424
+
425
+ - `bold`, `dim`, `italic`, `underline`, `blink`, `inverse`, `hidden`, `strikethrough`
426
+
427
+ ### Advanced Methods
428
+
429
+ - `rgb(r, g, b)`, `bgRgb(r, g, b)`
430
+ - `hex(color)`, `bgHex(color)`
431
+ - `hsl(h, s, l)`, `bgHsl(h, s, l)`
432
+
433
+ ### Utilities
434
+
435
+ - `strip(text)` - Remove ANSI codes
436
+ - `length(text)` - Get text length without ANSI codes
437
+ - `template` - Template literal support
438
+
439
+ ### Effects
440
+
441
+ - `gradient(text, startColor, endColor)`
442
+ - `rainbow(text)`
443
+ - `pulse(text, color?)`
444
+ - `zebra(text, color1?, color2?)`
445
+ - `neon(text, color?)`
446
+ - `shadow(text, color?, shadowColor?)`
447
+ - `box(text, options?)`
448
+ - `progressBar(progress, total, options?)`
449
+ - `spinner(frame, color?)`
450
+ - `table(data, options?)`
451
+
452
+ ## ๐ŸŒŸ Examples
453
+
454
+ Check out the [examples](./examples) directory for more comprehensive usage examples:
455
+
456
+ - [Basic Usage](./examples/demo.ts) - Complete feature demonstration
457
+ - [Performance Benchmark](./benchmarks/comparison.ts) - Performance comparison
458
+
459
+ ## ๐Ÿงช Testing
460
+
461
+ Run the test suite:
462
+
463
+ ```bash
464
+ npm test
465
+ ```
466
+
467
+ Run tests with coverage:
468
+
469
+ ```bash
470
+ npm run test:coverage
471
+ ```
472
+
473
+ ## ๐Ÿค Contributing
474
+
475
+ Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
476
+
477
+ 1. Fork the repository
478
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
479
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
480
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
481
+ 5. Open a Pull Request
482
+
483
+ ## ๐Ÿ“ License
484
+
485
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
486
+
487
+ ## ๐Ÿ™ Acknowledgments
488
+
489
+ - Inspired by [chalk](https://github.com/chalk/chalk) - The original terminal styling library
490
+ - Thanks to all contributors and the open source community
491
+
492
+ ## ๐Ÿ“ž Support
493
+
494
+ - ๐Ÿ“ง Email: [dev.reactbd@gmail.com](mailto:dev.reactbd@gmail.com)
495
+ - ๐Ÿ› Issues: [GitHub Issues](https://github.com/noorjsdivs/chalk-ts/issues)
496
+ - ๐Ÿ’ฌ Discussions: [GitHub Discussions](https://github.com/noorjsdivs/chalk-ts/discussions)
497
+
498
+ ---
499
+
500
+ Made with โค๏ธ by [Noor Mohammad](https://github.com/noorjsdivs)
501
+
502
+ โญ Star this repo if you find it useful!
package/dist/ansi.d.ts ADDED
@@ -0,0 +1,57 @@
1
+ /**
2
+ * ANSI color and style codes
3
+ */
4
+ export declare const ANSI_CODES: {
5
+ readonly reset: "\u001B[0m";
6
+ readonly bold: "\u001B[1m";
7
+ readonly dim: "\u001B[2m";
8
+ readonly italic: "\u001B[3m";
9
+ readonly underline: "\u001B[4m";
10
+ readonly blink: "\u001B[5m";
11
+ readonly inverse: "\u001B[7m";
12
+ readonly hidden: "\u001B[8m";
13
+ readonly strikethrough: "\u001B[9m";
14
+ readonly black: "\u001B[30m";
15
+ readonly red: "\u001B[31m";
16
+ readonly green: "\u001B[32m";
17
+ readonly yellow: "\u001B[33m";
18
+ readonly blue: "\u001B[34m";
19
+ readonly magenta: "\u001B[35m";
20
+ readonly cyan: "\u001B[36m";
21
+ readonly white: "\u001B[37m";
22
+ readonly gray: "\u001B[90m";
23
+ readonly grey: "\u001B[90m";
24
+ readonly redBright: "\u001B[91m";
25
+ readonly greenBright: "\u001B[92m";
26
+ readonly yellowBright: "\u001B[93m";
27
+ readonly blueBright: "\u001B[94m";
28
+ readonly magentaBright: "\u001B[95m";
29
+ readonly cyanBright: "\u001B[96m";
30
+ readonly whiteBright: "\u001B[97m";
31
+ readonly bgBlack: "\u001B[40m";
32
+ readonly bgRed: "\u001B[41m";
33
+ readonly bgGreen: "\u001B[42m";
34
+ readonly bgYellow: "\u001B[43m";
35
+ readonly bgBlue: "\u001B[44m";
36
+ readonly bgMagenta: "\u001B[45m";
37
+ readonly bgCyan: "\u001B[46m";
38
+ readonly bgWhite: "\u001B[47m";
39
+ readonly bgGray: "\u001B[100m";
40
+ readonly bgGrey: "\u001B[100m";
41
+ readonly bgRedBright: "\u001B[101m";
42
+ readonly bgGreenBright: "\u001B[102m";
43
+ readonly bgYellowBright: "\u001B[103m";
44
+ readonly bgBlueBright: "\u001B[104m";
45
+ readonly bgMagentaBright: "\u001B[105m";
46
+ readonly bgCyanBright: "\u001B[106m";
47
+ readonly bgWhiteBright: "\u001B[107m";
48
+ };
49
+ /**
50
+ * Check if colors are supported in the current environment
51
+ */
52
+ export declare function supportsColor(): boolean;
53
+ /**
54
+ * Get color level support (0: no color, 1: basic, 2: 256 colors, 3: 16m colors)
55
+ */
56
+ export declare function getColorLevel(): 0 | 1 | 2 | 3;
57
+ //# sourceMappingURL=ansi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ansi.d.ts","sourceRoot":"","sources":["../src/ansi.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDb,CAAC;AAEX;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAmCvC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAS7C"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Styling function type
3
+ */
4
+ export type StyleFunction = (text: string) => string;
5
+ /**
6
+ * Template function type for template literals
7
+ */
8
+ export type TemplateFunction = (template: TemplateStringsArray, ...substitutions: unknown[]) => string;
9
+ /**
10
+ * Main ChalkTS class with all styling capabilities
11
+ */
12
+ export declare class ChalkTS {
13
+ private readonly colorEnabled;
14
+ constructor(enabled?: boolean);
15
+ /**
16
+ * Apply ANSI codes to text
17
+ */
18
+ private apply;
19
+ /**
20
+ * Create a new instance with color support disabled
21
+ */
22
+ get disabled(): ChalkTS;
23
+ /**
24
+ * Create a new instance with color support enabled
25
+ */
26
+ get enabled(): ChalkTS;
27
+ get bold(): ChalkTS & StyleFunction;
28
+ get dim(): ChalkTS & StyleFunction;
29
+ get italic(): ChalkTS & StyleFunction;
30
+ get underline(): ChalkTS & StyleFunction;
31
+ get blink(): ChalkTS & StyleFunction;
32
+ get inverse(): ChalkTS & StyleFunction;
33
+ get hidden(): ChalkTS & StyleFunction;
34
+ get strikethrough(): ChalkTS & StyleFunction;
35
+ get black(): ChalkTS & StyleFunction;
36
+ get red(): ChalkTS & StyleFunction;
37
+ get green(): ChalkTS & StyleFunction;
38
+ get yellow(): ChalkTS & StyleFunction;
39
+ get blue(): ChalkTS & StyleFunction;
40
+ get magenta(): ChalkTS & StyleFunction;
41
+ get cyan(): ChalkTS & StyleFunction;
42
+ get white(): ChalkTS & StyleFunction;
43
+ get gray(): ChalkTS & StyleFunction;
44
+ get grey(): ChalkTS & StyleFunction;
45
+ get redBright(): ChalkTS & StyleFunction;
46
+ get greenBright(): ChalkTS & StyleFunction;
47
+ get yellowBright(): ChalkTS & StyleFunction;
48
+ get blueBright(): ChalkTS & StyleFunction;
49
+ get magentaBright(): ChalkTS & StyleFunction;
50
+ get cyanBright(): ChalkTS & StyleFunction;
51
+ get whiteBright(): ChalkTS & StyleFunction;
52
+ get bgBlack(): ChalkTS & StyleFunction;
53
+ get bgRed(): ChalkTS & StyleFunction;
54
+ get bgGreen(): ChalkTS & StyleFunction;
55
+ get bgYellow(): ChalkTS & StyleFunction;
56
+ get bgBlue(): ChalkTS & StyleFunction;
57
+ get bgMagenta(): ChalkTS & StyleFunction;
58
+ get bgCyan(): ChalkTS & StyleFunction;
59
+ get bgWhite(): ChalkTS & StyleFunction;
60
+ get bgGray(): ChalkTS & StyleFunction;
61
+ get bgGrey(): ChalkTS & StyleFunction;
62
+ get bgRedBright(): ChalkTS & StyleFunction;
63
+ get bgGreenBright(): ChalkTS & StyleFunction;
64
+ get bgYellowBright(): ChalkTS & StyleFunction;
65
+ get bgBlueBright(): ChalkTS & StyleFunction;
66
+ get bgMagentaBright(): ChalkTS & StyleFunction;
67
+ get bgCyanBright(): ChalkTS & StyleFunction;
68
+ get bgWhiteBright(): ChalkTS & StyleFunction;
69
+ rgb(r: number, g: number, b: number): ChalkTS & StyleFunction;
70
+ bgRgb(r: number, g: number, b: number): ChalkTS & StyleFunction;
71
+ hex(color: string): ChalkTS & StyleFunction;
72
+ bgHex(color: string): ChalkTS & StyleFunction;
73
+ hsl(h: number, s: number, l: number): ChalkTS & StyleFunction;
74
+ bgHsl(h: number, s: number, l: number): ChalkTS & StyleFunction;
75
+ get orange(): ChalkTS & StyleFunction;
76
+ get purple(): ChalkTS & StyleFunction;
77
+ get pink(): ChalkTS & StyleFunction;
78
+ get brown(): ChalkTS & StyleFunction;
79
+ get lime(): ChalkTS & StyleFunction;
80
+ get indigo(): ChalkTS & StyleFunction;
81
+ get violet(): ChalkTS & StyleFunction;
82
+ get turquoise(): ChalkTS & StyleFunction;
83
+ get gold(): ChalkTS & StyleFunction;
84
+ get silver(): ChalkTS & StyleFunction;
85
+ strip(text: string): string;
86
+ length(text: string): number;
87
+ template(template: TemplateStringsArray, ...substitutions: unknown[]): string;
88
+ /**
89
+ * Create a styled function that can be chained
90
+ */
91
+ private createStyler;
92
+ }
93
+ /**
94
+ * Default instance
95
+ */
96
+ export declare const chalkTs: ChalkTS;
97
+ /**
98
+ * Export individual color functions for convenience
99
+ */
100
+ export declare const bold: ChalkTS & StyleFunction, dim: ChalkTS & StyleFunction, italic: ChalkTS & StyleFunction, underline: ChalkTS & StyleFunction, blink: ChalkTS & StyleFunction, inverse: ChalkTS & StyleFunction, hidden: ChalkTS & StyleFunction, strikethrough: ChalkTS & StyleFunction, black: ChalkTS & StyleFunction, red: ChalkTS & StyleFunction, green: ChalkTS & StyleFunction, yellow: ChalkTS & StyleFunction, blue: ChalkTS & StyleFunction, magenta: ChalkTS & StyleFunction, cyan: ChalkTS & StyleFunction, white: ChalkTS & StyleFunction, gray: ChalkTS & StyleFunction, grey: ChalkTS & StyleFunction, redBright: ChalkTS & StyleFunction, greenBright: ChalkTS & StyleFunction, yellowBright: ChalkTS & StyleFunction, blueBright: ChalkTS & StyleFunction, magentaBright: ChalkTS & StyleFunction, cyanBright: ChalkTS & StyleFunction, whiteBright: ChalkTS & StyleFunction, bgBlack: ChalkTS & StyleFunction, bgRed: ChalkTS & StyleFunction, bgGreen: ChalkTS & StyleFunction, bgYellow: ChalkTS & StyleFunction, bgBlue: ChalkTS & StyleFunction, bgMagenta: ChalkTS & StyleFunction, bgCyan: ChalkTS & StyleFunction, bgWhite: ChalkTS & StyleFunction, bgGray: ChalkTS & StyleFunction, bgGrey: ChalkTS & StyleFunction, bgRedBright: ChalkTS & StyleFunction, bgGreenBright: ChalkTS & StyleFunction, bgYellowBright: ChalkTS & StyleFunction, bgBlueBright: ChalkTS & StyleFunction, bgMagentaBright: ChalkTS & StyleFunction, bgCyanBright: ChalkTS & StyleFunction, bgWhiteBright: ChalkTS & StyleFunction, orange: ChalkTS & StyleFunction, purple: ChalkTS & StyleFunction, pink: ChalkTS & StyleFunction, brown: ChalkTS & StyleFunction, lime: ChalkTS & StyleFunction, indigo: ChalkTS & StyleFunction, violet: ChalkTS & StyleFunction, turquoise: ChalkTS & StyleFunction, gold: ChalkTS & StyleFunction, silver: ChalkTS & StyleFunction;
101
+ //# sourceMappingURL=chalk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chalk.d.ts","sourceRoot":"","sources":["../src/chalk.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,QAAQ,EAAE,oBAAoB,EAC9B,GAAG,aAAa,EAAE,OAAO,EAAE,KACxB,MAAM,CAAC;AAEZ;;GAEG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;gBAE3B,OAAO,CAAC,EAAE,OAAO;IAI7B;;OAEG;IACH,OAAO,CAAC,KAAK;IAOb;;OAEG;IACH,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAGD,IAAI,IAAI,IAAI,OAAO,GAAG,aAAa,CAElC;IAED,IAAI,GAAG,IAAI,OAAO,GAAG,aAAa,CAEjC;IAED,IAAI,MAAM,IAAI,OAAO,GAAG,aAAa,CAEpC;IAED,IAAI,SAAS,IAAI,OAAO,GAAG,aAAa,CAEvC;IAED,IAAI,KAAK,IAAI,OAAO,GAAG,aAAa,CAEnC;IAED,IAAI,OAAO,IAAI,OAAO,GAAG,aAAa,CAErC;IAED,IAAI,MAAM,IAAI,OAAO,GAAG,aAAa,CAEpC;IAED,IAAI,aAAa,IAAI,OAAO,GAAG,aAAa,CAE3C;IAGD,IAAI,KAAK,IAAI,OAAO,GAAG,aAAa,CAEnC;IAED,IAAI,GAAG,IAAI,OAAO,GAAG,aAAa,CAEjC;IAED,IAAI,KAAK,IAAI,OAAO,GAAG,aAAa,CAEnC;IAED,IAA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