chalk-ts 1.0.0 โ†’ 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,27 +9,42 @@
9
9
  [![npm version](https://badge.fury.io/js/chalk-ts.svg)](https://badge.fury.io/js/chalk-ts)
10
10
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
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)
12
+ [![Test Coverage](https://img.shields.io/badge/coverage-98%25-brightgreen.svg)](https://github.com/noorjsdivs/chalk-ts)
13
13
  [![YouTube](https://img.shields.io/badge/YouTube-ReactJS%20BD-red.svg?logo=youtube)](https://www.youtube.com/@reactjsBD)
14
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
15
 
16
16
  </div>
17
17
 
18
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.
19
+ > A powerful, feature-rich alternative to chalk with enhanced capabilities, TrueColor support, visual effects, and modern development experience.
20
20
 
21
21
  ## โœจ Features
22
22
 
23
- - ๐ŸŽจ **Rich Color Support**: 20+ built-in colors, RGB, HEX, HSL support
24
- - ๐ŸŽญ **Advanced Effects**: Gradient, rainbow, pulse, neon, shadow effects
23
+ - ๐ŸŽจ **Rich Color Support**: 20+ built-in colors, TrueColor (RGB/HEX/HSL)
24
+ - ๐ŸŽญ **Advanced Effects**: Gradients, rainbow, pulse, neon, shadow, zebra stripes
25
25
  - ๐Ÿ› ๏ธ **Built-in Utilities**: Tables, progress bars, boxes, spinners
26
+ - ๐ŸŽฏ **Semantic Theming**: Create reusable theme configurations
26
27
  - ๐Ÿ”’ **TypeScript First**: Full type safety with excellent IntelliSense
27
- - ๐Ÿ“ฆ **Zero Dependencies**: No external packages, minimal bundle size
28
+ - ๐Ÿ“ฆ **Zero Dependencies**: No external packages, minimal bundle size (~15KB)
28
29
  - ๐ŸŒณ **Tree Shakeable**: Import only what you need
29
30
  - โšก **High Performance**: Optimized for speed and efficiency
30
31
  - ๐Ÿ”ง **Easy Migration**: Drop-in replacement for most chalk usage
32
+ - ๐ŸŒ **Web Demo**: Interactive browser-based demo with live examples
31
33
  - ๐Ÿ“– **Comprehensive Docs**: Extensive documentation and examples
32
- - ๐Ÿงช **Well Tested**: 95%+ test coverage
34
+ - ๐Ÿงช **Well Tested**: 98%+ test coverage with 98 passing tests
35
+
36
+ ## ๐ŸŒ Interactive Demo
37
+
38
+ Try out all features in your browser: **[Live Web Demo](https://www.reactbd.com/npm-packages/chalk-ts-typescript)**
39
+
40
+ The demo includes:
41
+
42
+ - โœ… All 20+ colors and backgrounds
43
+ - โœ… TrueColor (RGB/HEX/HSL) examples
44
+ - โœ… Visual effects (gradients, rainbow, neon, etc.)
45
+ - โœ… Utilities (boxes, tables, progress bars)
46
+ - โœ… Code snippets with copy functionality
47
+ - โœ… Live terminal output rendering
33
48
 
34
49
  ## ๐Ÿ“ฆ Installation
35
50
 
@@ -45,29 +60,44 @@ yarn add chalk-ts
45
60
  pnpm add chalk-ts
46
61
  ```
47
62
 
63
+ ```bash
64
+ bun add chalk-ts
65
+ ```
66
+
48
67
  ## ๐Ÿš€ Quick Start
49
68
 
50
69
  ```typescript
51
- import chalkTs from "chalk-ts";
70
+ import chalk from "chalk-ts";
52
71
 
53
72
  // Basic colors
54
- console.log(chalkTs.red("Hello World!"));
55
- console.log(chalkTs.green.bold("Success message"));
73
+ console.log(chalk.red("Hello World!"));
74
+ console.log(chalk.green.bold("Success message"));
56
75
 
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"));
76
+ // TrueColor support
77
+ console.log(chalk.rgb(255, 136, 0)("Custom RGB color"));
78
+ console.log(chalk.hex("#ff8800")("HEX color"));
79
+ console.log(chalk.hsl(30, 100, 50)("HSL color"));
61
80
 
62
81
  // Method chaining
63
- console.log(chalkTs.bold.red.bgYellow("Styled text"));
82
+ console.log(chalk.bold.red.bgYellow("Styled text"));
64
83
 
65
84
  // Advanced effects
66
- import { gradient, rainbow, box } from "chalk-ts";
85
+ import { gradient, rainbow, box, createTheme } from "chalk-ts";
67
86
 
68
- console.log(gradient("Gradient text!", "#ff0000", "#0000ff"));
87
+ console.log(gradient("Gradient text!", ["#ff0000", "#00ff00", "#0000ff"]));
69
88
  console.log(rainbow("Rainbow colors!"));
70
89
  console.log(box("Boxed text"));
90
+
91
+ // Semantic theming
92
+ const theme = createTheme({
93
+ info: chalk.blue.bold,
94
+ success: chalk.green,
95
+ error: chalk.red.bold,
96
+ });
97
+
98
+ console.log(theme.info("Info message"));
99
+ console.log(theme.success("Success!"));
100
+ console.log(theme.error("Error occurred"));
71
101
  ```
72
102
 
73
103
  ## ๐ŸŽจ Basic Styling
@@ -75,38 +105,41 @@ console.log(box("Boxed text"));
75
105
  ### Text Styles
76
106
 
77
107
  ```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"));
108
+ import chalk from "chalk-ts";
109
+
110
+ console.log(chalk.bold("Bold text"));
111
+ console.log(chalk.italic("Italic text"));
112
+ console.log(chalk.underline("Underlined text"));
113
+ console.log(chalk.strikethrough("Strikethrough text"));
114
+ console.log(chalk.dim("Dimmed text"));
115
+ console.log(chalk.inverse("Inverted text"));
86
116
  ```
87
117
 
88
118
  ### Basic Colors
89
119
 
90
120
  ```typescript
91
121
  // 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"));
122
+ console.log(chalk.black("Black text"));
123
+ console.log(chalk.red("Red text"));
124
+ console.log(chalk.green("Green text"));
125
+ console.log(chalk.yellow("Yellow text"));
126
+ console.log(chalk.blue("Blue text"));
127
+ console.log(chalk.magenta("Magenta text"));
128
+ console.log(chalk.cyan("Cyan text"));
129
+ console.log(chalk.white("White text"));
130
+ console.log(chalk.gray("Gray text"));
100
131
 
101
132
  // Background colors
102
- console.log(chalkTs.bgRed("Red background"));
103
- console.log(chalkTs.bgGreen("Green background"));
104
- console.log(chalkTs.bgBlue("Blue background"));
133
+ console.log(chalk.bgRed("Red background"));
134
+ console.log(chalk.bgGreen("Green background"));
135
+ console.log(chalk.bgBlue("Blue background"));
136
+ console.log(chalk.bgYellow("Yellow background"));
105
137
 
106
138
  // Bright colors
107
- console.log(chalkTs.redBright("Bright red"));
108
- console.log(chalkTs.greenBright("Bright green"));
109
- console.log(chalkTs.blueBright("Bright blue"));
139
+ console.log(chalk.redBright("Bright red"));
140
+ console.log(chalk.greenBright("Bright green"));
141
+ console.log(chalk.blueBright("Bright blue"));
142
+ console.log(chalk.yellowBright("Bright yellow"));
110
143
  ```
111
144
 
112
145
  ### Extended Color Palette
@@ -114,61 +147,81 @@ console.log(chalkTs.blueBright("Bright blue"));
114
147
  chalk-ts includes 20+ built-in colors beyond the standard ANSI colors:
115
148
 
116
149
  ```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"));
150
+ console.log(chalk.orange("Orange text"));
151
+ console.log(chalk.purple("Purple text"));
152
+ console.log(chalk.pink("Pink text"));
153
+ console.log(chalk.brown("Brown text"));
154
+ console.log(chalk.lime("Lime text"));
155
+ console.log(chalk.indigo("Indigo text"));
156
+ console.log(chalk.violet("Violet text"));
157
+ console.log(chalk.turquoise("Turquoise text"));
158
+ console.log(chalk.gold("Gold text"));
159
+ console.log(chalk.silver("Silver text"));
160
+ console.log(chalk.crimson("Crimson text"));
161
+ console.log(chalk.navy("Navy text"));
162
+ console.log(chalk.teal("Teal text"));
163
+ console.log(chalk.olive("Olive text"));
164
+ console.log(chalk.maroon("Maroon text"));
127
165
  ```
128
166
 
129
- ## ๐ŸŒˆ Advanced Colors
167
+ ## ๐ŸŒˆ TrueColor Support
130
168
 
131
- ### RGB Colors
169
+ ### RGB Colors (24-bit)
132
170
 
133
171
  ```typescript
134
172
  // Foreground RGB
135
- console.log(chalkTs.rgb(255, 136, 0)("Orange RGB"));
173
+ console.log(chalk.rgb(255, 136, 0)("Custom Orange"));
174
+ console.log(chalk.rgb(100, 200, 255)("Sky Blue"));
136
175
 
137
176
  // Background RGB
138
- console.log(chalkTs.bgRgb(255, 136, 0)("Orange background"));
177
+ console.log(chalk.bgRgb(255, 136, 0)("Orange background"));
178
+ console.log(chalk.bgRgb(100, 200, 255)("Sky blue background"));
139
179
  ```
140
180
 
141
181
  ### HEX Colors
142
182
 
143
183
  ```typescript
144
184
  // Foreground HEX
145
- console.log(chalkTs.hex("#ff8800")("Orange HEX"));
185
+ console.log(chalk.hex("#ff8800")("Orange HEX"));
186
+ console.log(chalk.hex("#64c8ff")("Sky Blue HEX"));
146
187
 
147
188
  // Background HEX
148
- console.log(chalkTs.bgHex("#ff8800")("Orange background"));
189
+ console.log(chalk.bgHex("#ff8800")("Orange background"));
190
+ console.log(chalk.bgHex("#64c8ff")("Sky blue background"));
149
191
  ```
150
192
 
151
193
  ### HSL Colors
152
194
 
153
195
  ```typescript
154
- // Foreground HSL
155
- console.log(chalkTs.hsl(30, 100, 50)("Orange HSL"));
196
+ // Foreground HSL (Hue, Saturation, Lightness)
197
+ console.log(chalk.hsl(30, 100, 50)("Orange HSL"));
198
+ console.log(chalk.hsl(200, 100, 70)("Sky Blue HSL"));
156
199
 
157
200
  // Background HSL
158
- console.log(chalkTs.bgHsl(30, 100, 50)("Orange background"));
201
+ console.log(chalk.bgHsl(30, 100, 50)("Orange background"));
202
+ console.log(chalk.bgHsl(200, 100, 70)("Sky blue background"));
159
203
  ```
160
204
 
161
- ## ๐ŸŽญ Advanced Effects
205
+ ## ๐ŸŽญ Visual Effects
162
206
 
163
207
  ### Gradient
164
208
 
165
- Create beautiful gradient effects between two colors:
209
+ Create beautiful gradient effects with multiple color stops:
166
210
 
167
211
  ```typescript
168
212
  import { gradient } from "chalk-ts";
169
213
 
170
- console.log(gradient("Gradient Text!", "#ff0000", "#0000ff"));
171
- console.log(gradient("Fire Effect", "#ff4500", "#ffd700"));
214
+ // Two-color gradient
215
+ console.log(gradient("Gradient Text!", ["#ff0000", "#0000ff"]));
216
+
217
+ // Multi-color gradient
218
+ console.log(gradient("Rainbow Gradient!", ["#ff0000", "#00ff00", "#0000ff"]));
219
+
220
+ // Fire effect
221
+ console.log(gradient("Fire Effect", ["#ff4500", "#ffd700"]));
222
+
223
+ // Ocean effect
224
+ console.log(gradient("Ocean Waves", ["#006994", "#00d4ff", "#7fffd4"]));
172
225
  ```
173
226
 
174
227
  ### Rainbow
@@ -201,7 +254,7 @@ Alternate between two colors:
201
254
  import { zebra } from "chalk-ts";
202
255
 
203
256
  console.log(zebra("Zebra effect", "red", "blue"));
204
- console.log(zebra("Alternating!", "green", "yellow"));
257
+ console.log(zebra("Alternating colors!", "green", "yellow"));
205
258
  ```
206
259
 
207
260
  ### Neon Effect
@@ -213,6 +266,7 @@ import { neon } from "chalk-ts";
213
266
 
214
267
  console.log(neon("Neon text!", "cyan"));
215
268
  console.log(neon("Glowing!", "magenta"));
269
+ console.log(neon("Electric!", "blue"));
216
270
  ```
217
271
 
218
272
  ### Shadow Effect
@@ -223,13 +277,14 @@ Add shadow to text:
223
277
  import { shadow } from "chalk-ts";
224
278
 
225
279
  console.log(shadow("Text with shadow", "cyan", "gray"));
280
+ console.log(shadow("Depth effect", "yellow", "black"));
226
281
  ```
227
282
 
228
283
  ## ๐Ÿ› ๏ธ Built-in Utilities
229
284
 
230
285
  ### Boxes
231
286
 
232
- Create beautiful boxes around text:
287
+ Create beautiful boxes around text with various styles:
233
288
 
234
289
  ```typescript
235
290
  import { box } from "chalk-ts";
@@ -243,52 +298,88 @@ console.log(
243
298
  padding: 2,
244
299
  color: "cyan",
245
300
  style: "double",
246
- })
301
+ }),
247
302
  );
248
303
 
249
- // Different styles: 'single', 'double', 'rounded', 'thick'
250
- console.log(box("Rounded", { style: "rounded" }));
304
+ // Different styles
305
+ console.log(box("Single Border", { style: "single" }));
306
+ console.log(box("Double Border", { style: "double" }));
307
+ console.log(box("Rounded Corners", { style: "rounded" }));
308
+ console.log(box("Thick Border", { style: "thick" }));
309
+
310
+ // Multi-line content
311
+ console.log(
312
+ box("Line 1\nLine 2\nLine 3", {
313
+ padding: 1,
314
+ color: "green",
315
+ }),
316
+ );
251
317
  ```
252
318
 
253
319
  ### Progress Bars
254
320
 
255
- Create progress indicators:
321
+ Create customizable progress indicators:
256
322
 
257
323
  ```typescript
258
324
  import { progressBar } from "chalk-ts";
259
325
 
326
+ // Simple progress bar
260
327
  console.log(progressBar(75, 100)); // 75% progress
328
+
329
+ // Customized progress bar
261
330
  console.log(
262
331
  progressBar(50, 100, {
263
332
  width: 30,
264
333
  complete: "โ– ",
265
334
  incomplete: "โ–ก",
266
335
  color: "green",
267
- })
336
+ }),
337
+ );
338
+
339
+ // Different styles
340
+ console.log(
341
+ progressBar(80, 100, {
342
+ complete: "โ–ˆ",
343
+ incomplete: "โ–‘",
344
+ color: "cyan",
345
+ }),
268
346
  );
269
347
  ```
270
348
 
271
349
  ### Tables
272
350
 
273
- Create formatted tables:
351
+ Create formatted tables with headers and custom styling:
274
352
 
275
353
  ```typescript
276
354
  import { table } from "chalk-ts";
277
355
 
278
356
  const data = [
279
- ["John", "25", "Engineer"],
280
- ["Jane", "30", "Designer"],
281
- ["Bob", "35", "Manager"],
357
+ ["John Doe", "28", "Developer"],
358
+ ["Jane Smith", "34", "Designer"],
359
+ ["Bob Johnson", "45", "Manager"],
282
360
  ];
283
361
 
284
362
  const headers = ["Name", "Age", "Role"];
285
363
 
364
+ // Table with headers
286
365
  console.log(
287
366
  table(data, {
288
367
  headers,
289
368
  headerColor: "cyan",
290
369
  borderColor: "gray",
291
- })
370
+ }),
371
+ );
372
+
373
+ // Table without headers
374
+ console.log(table(data));
375
+
376
+ // Custom styling
377
+ console.log(
378
+ table(data, {
379
+ headers,
380
+ headerColor: "yellow",
381
+ borderColor: "blue",
382
+ }),
292
383
  );
293
384
  ```
294
385
 
@@ -301,8 +392,53 @@ import { spinner } from "chalk-ts";
301
392
 
302
393
  // Display different frames
303
394
  for (let i = 0; i < 10; i++) {
304
- console.log(spinner(i, "cyan"));
395
+ console.clear();
396
+ console.log(spinner(i, "cyan") + " Loading...");
397
+ await new Promise((resolve) => setTimeout(resolve, 100));
305
398
  }
399
+
400
+ // Different colors
401
+ console.log(spinner(0, "green") + " Processing...");
402
+ console.log(spinner(1, "yellow") + " Working...");
403
+ console.log(spinner(2, "magenta") + " Please wait...");
404
+ ```
405
+
406
+ ## ๐ŸŽฏ Semantic Theming
407
+
408
+ Create reusable theme configurations for consistent styling:
409
+
410
+ ```typescript
411
+ import { createTheme } from "chalk-ts";
412
+ import chalk from "chalk-ts";
413
+
414
+ // Define your theme
415
+ const theme = createTheme({
416
+ info: chalk.blue.bold,
417
+ success: chalk.green,
418
+ warning: chalk.yellow.bold,
419
+ error: chalk.red.bold.bgWhite,
420
+ debug: chalk.gray.dim,
421
+ });
422
+
423
+ // Use the theme
424
+ console.log(theme.info("Application started"));
425
+ console.log(theme.success("โœ“ Task completed successfully"));
426
+ console.log(theme.warning("โš  Warning: Low memory"));
427
+ console.log(theme.error("โœ— Error: Connection failed"));
428
+ console.log(theme.debug("Debug: Variable value = 42"));
429
+
430
+ // Themes can use any chalk styling
431
+ const fancyTheme = createTheme({
432
+ header: chalk.bold.underline.cyan,
433
+ subheader: chalk.italic.blue,
434
+ highlight: chalk.bgYellow.black.bold,
435
+ muted: chalk.dim.gray,
436
+ });
437
+
438
+ console.log(fancyTheme.header("Main Title"));
439
+ console.log(fancyTheme.subheader("Subtitle"));
440
+ console.log(fancyTheme.highlight("Important!"));
441
+ console.log(fancyTheme.muted("Less important"));
306
442
  ```
307
443
 
308
444
  ## ๐Ÿ”— Method Chaining
@@ -311,24 +447,29 @@ chalk-ts supports full method chaining for complex styling:
311
447
 
312
448
  ```typescript
313
449
  // Combine multiple styles
314
- console.log(chalkTs.bold.red.bgYellow("Complex styling"));
450
+ console.log(chalk.bold.red.bgYellow("Complex styling"));
315
451
 
316
- // Chain with custom colors
317
- console.log(chalkTs.bold.rgb(255, 100, 0).bgHex("#000000")("Custom chain"));
452
+ // Chain with TrueColor
453
+ console.log(chalk.bold.rgb(255, 100, 0).bgHex("#000000")("Custom chain"));
318
454
 
319
455
  // Multiple text effects
320
- console.log(chalkTs.bold.italic.underline.red("All effects"));
456
+ console.log(chalk.bold.italic.underline.red("All effects"));
457
+
458
+ // Nested styling
459
+ console.log(
460
+ chalk.blue("Blue text with " + chalk.red.bold("red bold") + " inside"),
461
+ );
321
462
  ```
322
463
 
323
- ## ๐Ÿ”ง Utilities
464
+ ## ๐Ÿ”ง Utility Methods
324
465
 
325
466
  ### Strip ANSI Codes
326
467
 
327
468
  Remove styling from text:
328
469
 
329
470
  ```typescript
330
- const styled = chalkTs.red.bold("Styled text");
331
- const plain = chalkTs.strip(styled);
471
+ const styled = chalk.red.bold("Styled text");
472
+ const plain = chalk.strip(styled);
332
473
  console.log(plain); // 'Styled text'
333
474
  ```
334
475
 
@@ -337,56 +478,75 @@ console.log(plain); // 'Styled text'
337
478
  Get the actual text length without ANSI codes:
338
479
 
339
480
  ```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)
481
+ const styled = chalk.red.bold("Hello");
482
+ console.log(styled.length); // Includes ANSI codes (e.g., 23)
483
+ console.log(chalk.length(styled)); // 5 (actual text length)
343
484
  ```
344
485
 
345
486
  ### Template Literals
346
487
 
347
- Support for template strings:
488
+ Support for template strings with embedded styling:
348
489
 
349
490
  ```typescript
350
491
  const name = "World";
351
- console.log(chalkTs.template`Hello ${chalkTs.red(name)}!`);
492
+ const greeting = chalk.template`Hello {red.bold ${name}}!`;
493
+ console.log(greeting);
494
+
495
+ // More complex templates
496
+ const status = "success";
497
+ const message = chalk.template`Status: {green.bold ${status}} - All systems operational`;
498
+ console.log(message);
352
499
  ```
353
500
 
354
- ### Color Detection
501
+ ## ๐ŸŽฎ Color Level Control
355
502
 
356
- Control color output:
503
+ Control color output levels for different environments:
357
504
 
358
505
  ```typescript
359
506
  import { ChalkTS } from "chalk-ts";
360
507
 
361
- // Force disable colors
362
- const noColors = new ChalkTS(false);
508
+ // Level 0: No colors
509
+ const noColors = new ChalkTS({ level: 0 });
363
510
  console.log(noColors.red("Plain text"));
364
511
 
365
- // Force enable colors
366
- const withColors = new ChalkTS(true);
367
- console.log(withColors.red("Red text"));
512
+ // Level 1: Basic 16 colors
513
+ const basicColors = new ChalkTS({ level: 1 });
514
+ console.log(basicColors.red("Basic red"));
515
+
516
+ // Level 2: 256 colors
517
+ const extendedColors = new ChalkTS({ level: 2 });
518
+ console.log(extendedColors.rgb(255, 100, 0)("Downsampled to 256"));
519
+
520
+ // Level 3: TrueColor (16 million colors)
521
+ const trueColor = new ChalkTS({ level: 3 });
522
+ console.log(trueColor.rgb(255, 100, 0)("Full RGB"));
523
+
524
+ // Auto-detect (default)
525
+ import chalk from "chalk-ts";
526
+ console.log(chalk.red("Auto-detected color level"));
368
527
  ```
369
528
 
370
- ## ๐Ÿ“Š Performance Comparison
529
+ ## ๐Ÿ“Š Performance & Comparison
371
530
 
372
531
  chalk-ts is designed for performance while providing more features:
373
532
 
374
- | Library | Bundle Size | Features | Performance | TypeScript |
375
- | --------- | ----------- | ---------- | ----------- | ---------- |
376
- | chalk-ts | ~15KB | โญโญโญโญโญ | โญโญโญโญโญ | โญโญโญโญโญ |
377
- | Chalk | ~17KB | โญโญโญ | โญโญโญโญ | โญโญโญโญ |
378
- | Colorette | ~8KB | โญโญ | โญโญโญโญโญ | โญโญโญ |
533
+ | Library | Bundle Size | Colors | Effects | Utilities | TypeScript | Tests |
534
+ | --------- | ----------- | ------ | ------- | --------- | ---------- | ----- |
535
+ | chalk-ts | ~15KB | 20+ | 6+ | 4+ | โญโญโญโญโญ | 98 |
536
+ | Chalk | ~17KB | 8 | 0 | 0 | โญโญโญโญ | - |
537
+ | Colorette | ~8KB | 8 | 0 | 0 | โญโญโญ | - |
379
538
 
380
539
  ### Why Choose chalk-ts?
381
540
 
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
541
+ 1. **๐ŸŽจ More Colors**: 20+ built-in colors + TrueColor support
542
+ 2. **๐ŸŽญ Visual Effects**: Gradients, rainbow, pulse, neon, shadow, zebra
543
+ 3. **๐Ÿ› ๏ธ Built-in Utilities**: Tables, progress bars, boxes, spinners
544
+ 4. **๐ŸŽฏ Theming**: Semantic theme system for consistent styling
545
+ 5. **๐Ÿ”’ Better Types**: Full TypeScript support with strict typing
546
+ 6. **๐Ÿ“ฆ Modern Build**: ES modules, tree-shaking, zero dependencies
547
+ 7. **๐Ÿงช Well Tested**: 98%+ coverage with 98 passing tests
548
+ 8. **๐Ÿ“– Great Docs**: Comprehensive documentation + interactive demo
549
+ 9. **๐Ÿ”ง Easy Migration**: Drop-in replacement for chalk
390
550
 
391
551
  ## ๐Ÿ”„ Migration from Chalk
392
552
 
@@ -397,64 +557,187 @@ chalk-ts is designed as a drop-in replacement for chalk:
397
557
  import chalk from "chalk";
398
558
  console.log(chalk.red.bold("Hello"));
399
559
 
400
- // After (chalk-ts)
401
- import chalkTs from "chalk-ts";
402
- console.log(chalkTs.red.bold("Hello"));
560
+ // After (chalk-ts) - same API!
561
+ import chalk from "chalk-ts";
562
+ console.log(chalk.red.bold("Hello"));
563
+
564
+ // Plus new features!
565
+ import { gradient, createTheme } from "chalk-ts";
566
+ console.log(gradient("Gradient!", ["#ff0000", "#0000ff"]));
403
567
  ```
404
568
 
405
- Most chalk code will work without changes, but you'll get additional features and better TypeScript support.
569
+ Most chalk code will work without changes, but you'll get:
570
+
571
+ - โœ… 20+ additional colors
572
+ - โœ… TrueColor (RGB/HEX/HSL) support
573
+ - โœ… Visual effects (gradients, rainbow, etc.)
574
+ - โœ… Built-in utilities (tables, boxes, etc.)
575
+ - โœ… Semantic theming
576
+ - โœ… Better TypeScript support
406
577
 
407
- ## ๐Ÿ“š API Reference
578
+ ## ๐Ÿ“š Complete API Reference
408
579
 
409
580
  ### Basic Colors
410
581
 
411
- - `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`, `gray`
412
- - `redBright`, `greenBright`, `yellowBright`, `blueBright`, `magentaBright`, `cyanBright`, `whiteBright`
582
+ `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`, `gray`
583
+
584
+ ### Bright Colors
585
+
586
+ `redBright`, `greenBright`, `yellowBright`, `blueBright`, `magentaBright`, `cyanBright`, `whiteBright`
413
587
 
414
588
  ### Background Colors
415
589
 
416
- - `bgBlack`, `bgRed`, `bgGreen`, `bgYellow`, `bgBlue`, `bgMagenta`, `bgCyan`, `bgWhite`, `bgGray`
417
- - `bgRedBright`, `bgGreenBright`, `bgYellowBright`, `bgBlueBright`, `bgMagentaBright`, `bgCyanBright`, `bgWhiteBright`
590
+ `bgBlack`, `bgRed`, `bgGreen`, `bgYellow`, `bgBlue`, `bgMagenta`, `bgCyan`, `bgWhite`, `bgGray`
591
+
592
+ ### Bright Backgrounds
418
593
 
419
- ### Extended Colors
594
+ `bgRedBright`, `bgGreenBright`, `bgYellowBright`, `bgBlueBright`, `bgMagentaBright`, `bgCyanBright`, `bgWhiteBright`
420
595
 
421
- - `orange`, `purple`, `pink`, `brown`, `lime`, `indigo`, `violet`, `turquoise`, `gold`, `silver`
596
+ ### Extended Colors (20+)
597
+
598
+ `orange`, `purple`, `pink`, `brown`, `lime`, `indigo`, `violet`, `turquoise`, `gold`, `silver`, `crimson`, `navy`, `teal`, `olive`, `maroon`
422
599
 
423
600
  ### Text Styles
424
601
 
425
- - `bold`, `dim`, `italic`, `underline`, `blink`, `inverse`, `hidden`, `strikethrough`
602
+ `bold`, `dim`, `italic`, `underline`, `blink`, `inverse`, `hidden`, `strikethrough`
426
603
 
427
- ### Advanced Methods
604
+ ### TrueColor Methods
428
605
 
429
- - `rgb(r, g, b)`, `bgRgb(r, g, b)`
430
- - `hex(color)`, `bgHex(color)`
431
- - `hsl(h, s, l)`, `bgHsl(h, s, l)`
606
+ - `rgb(r, g, b)` - Foreground RGB color
607
+ - `bgRgb(r, g, b)` - Background RGB color
608
+ - `hex(color)` - Foreground HEX color
609
+ - `bgHex(color)` - Background HEX color
610
+ - `hsl(h, s, l)` - Foreground HSL color
611
+ - `bgHsl(h, s, l)` - Background HSL color
432
612
 
433
- ### Utilities
613
+ ### Utility Methods
434
614
 
435
- - `strip(text)` - Remove ANSI codes
615
+ - `strip(text)` - Remove ANSI codes from text
436
616
  - `length(text)` - Get text length without ANSI codes
437
617
  - `template` - Template literal support
438
618
 
439
- ### Effects
619
+ ### Visual Effects
440
620
 
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?)`
621
+ - `gradient(text, colors[])` - Multi-color gradient
622
+ - `rainbow(text)` - Rainbow effect
623
+ - `pulse(text, color?)` - Pulsing effect
624
+ - `zebra(text, color1?, color2?)` - Alternating colors
625
+ - `neon(text, color?)` - Neon glow effect
626
+ - `shadow(text, color?, shadowColor?)` - Shadow effect
627
+
628
+ ### Utilities
629
+
630
+ - `box(text, options?)` - Create bordered box
631
+ - `progressBar(current, total, options?)` - Progress indicator
632
+ - `spinner(frame, color?)` - Loading spinner
633
+ - `table(data, options?)` - Formatted table
634
+
635
+ ### Theming
636
+
637
+ - `createTheme(config)` - Create semantic theme
451
638
 
452
639
  ## ๐ŸŒŸ Examples
453
640
 
454
- Check out the [examples](./examples) directory for more comprehensive usage examples:
641
+ ### CLI Application
642
+
643
+ ```typescript
644
+ import chalk from "chalk-ts";
645
+ import { box, progressBar, createTheme } from "chalk-ts";
646
+
647
+ const theme = createTheme({
648
+ info: chalk.blue.bold,
649
+ success: chalk.green.bold,
650
+ error: chalk.red.bold,
651
+ });
652
+
653
+ console.log(
654
+ box("My CLI App v1.0.0", {
655
+ padding: 1,
656
+ color: "cyan",
657
+ style: "rounded",
658
+ }),
659
+ );
660
+
661
+ console.log(theme.info("Starting installation..."));
662
+ console.log(progressBar(50, 100, { color: "cyan" }));
663
+ console.log(theme.success("โœ“ Installation complete!"));
664
+ ```
455
665
 
456
- - [Basic Usage](./examples/demo.ts) - Complete feature demonstration
457
- - [Performance Benchmark](./benchmarks/comparison.ts) - Performance comparison
666
+ ### Log System
667
+
668
+ ```typescript
669
+ import chalk from "chalk-ts";
670
+ import { createTheme } from "chalk-ts";
671
+
672
+ const logTheme = createTheme({
673
+ debug: chalk.gray.dim,
674
+ info: chalk.blue,
675
+ warn: chalk.yellow.bold,
676
+ error: chalk.red.bold.bgWhite,
677
+ success: chalk.green.bold,
678
+ });
679
+
680
+ class Logger {
681
+ debug(msg: string) {
682
+ console.log(logTheme.debug(`[DEBUG] ${msg}`));
683
+ }
684
+ info(msg: string) {
685
+ console.log(logTheme.info(`[INFO] ${msg}`));
686
+ }
687
+ warn(msg: string) {
688
+ console.log(logTheme.warn(`[WARN] ${msg}`));
689
+ }
690
+ error(msg: string) {
691
+ console.log(logTheme.error(`[ERROR] ${msg}`));
692
+ }
693
+ success(msg: string) {
694
+ console.log(logTheme.success(`[SUCCESS] ${msg}`));
695
+ }
696
+ }
697
+
698
+ const logger = new Logger();
699
+ logger.info("Application started");
700
+ logger.success("Connected to database");
701
+ logger.warn("High memory usage detected");
702
+ logger.error("Failed to load configuration");
703
+ ```
704
+
705
+ ### Data Visualization
706
+
707
+ ```typescript
708
+ import { table, progressBar, gradient } from "chalk-ts";
709
+
710
+ // Sales report
711
+ const salesData = [
712
+ ["Product A", "$1,234", "โ†‘ 15%"],
713
+ ["Product B", "$2,456", "โ†‘ 23%"],
714
+ ["Product C", "$987", "โ†“ 5%"],
715
+ ];
716
+
717
+ console.log(gradient("SALES REPORT", ["#00d4ff", "#7fffd4"]));
718
+ console.log(
719
+ table(salesData, {
720
+ headers: ["Product", "Revenue", "Change"],
721
+ headerColor: "cyan",
722
+ borderColor: "gray",
723
+ }),
724
+ );
725
+
726
+ console.log("\nQuarterly Progress:");
727
+ console.log(
728
+ progressBar(75, 100, {
729
+ width: 40,
730
+ color: "green",
731
+ complete: "โ–ˆ",
732
+ incomplete: "โ–‘",
733
+ }),
734
+ );
735
+ ```
736
+
737
+ Check out more examples:
738
+
739
+ - [Complete Demo](./examples/demo.ts) - All features showcase
740
+ - [Web Demo](https://www.reactbd.com/npm-packages/chalk-ts-typescript) - Interactive browser demo
458
741
 
459
742
  ## ๐Ÿงช Testing
460
743
 
@@ -470,33 +753,61 @@ Run tests with coverage:
470
753
  npm run test:coverage
471
754
  ```
472
755
 
756
+ Run demo:
757
+
758
+ ```bash
759
+ npm run demo
760
+ ```
761
+
473
762
  ## ๐Ÿค Contributing
474
763
 
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.
764
+ Contributions are welcome! Please feel free to submit a Pull Request.
476
765
 
477
766
  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`)
767
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
768
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
769
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
481
770
  5. Open a Pull Request
482
771
 
483
- ## ๐Ÿ“ License
772
+ ## ๐Ÿ“„ License
484
773
 
485
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
774
+ MIT License - see the [LICENSE](LICENSE) file for details.
486
775
 
487
776
  ## ๐Ÿ™ Acknowledgments
488
777
 
489
- - Inspired by [chalk](https://github.com/chalk/chalk) - The original terminal styling library
778
+ Inspired by:
779
+
780
+ - [chalk](https://github.com/chalk/chalk) - The original terminal styling library
490
781
  - Thanks to all contributors and the open source community
491
782
 
492
783
  ## ๐Ÿ“ž Support
493
784
 
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)
785
+ If you have any questions or need help, please:
786
+
787
+ - ๐ŸŒ **Homepage**: [reactbd.com/npm-packages/chalk-ts-typescript](https://www.reactbd.com/npm-packages/chalk-ts-typescript)
788
+ - ๐Ÿ“ฆ **NPM**: [npmjs.com/package/chalk-ts](https://www.npmjs.com/package/chalk-ts)
789
+ - ๐Ÿ’ป **GitHub**: [github.com/noorjsdivs/chalk-ts](https://github.com/noorjsdivs/chalk-ts)
790
+ - ๐Ÿ› **Issues**: [GitHub Issues](https://github.com/noorjsdivs/chalk-ts/issues)
791
+ - ๐Ÿ’ฌ **Discussions**: [GitHub Discussions](https://github.com/noorjsdivs/chalk-ts/discussions)
792
+ - ๐Ÿ“ง **Email**: [dev.reactbd@gmail.com](mailto:dev.reactbd@gmail.com)
793
+ - ๐ŸŽฅ **YouTube**: [@reactjsBD](https://www.youtube.com/@reactjsBD)
794
+
795
+ ## ๐ŸŽ‰ Show Your Support
796
+
797
+ If this library helped you, please give it a โญ๏ธ on GitHub!
798
+
799
+ You can also support the development of this project by buying me a coffee:
800
+
801
+ <a href="https://buymeacoffee.com/reactbd" target="_blank">
802
+ <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" >
803
+ </a>
497
804
 
498
805
  ---
499
806
 
500
- Made with โค๏ธ by [Noor Mohammad](https://github.com/noorjsdivs)
807
+ <div align="center">
808
+
809
+ [Made with โค๏ธ by Noor Mohammad](https://reactbd.com)
810
+
811
+ โญ **Star this repo if you find it useful!**
501
812
 
502
- โญ Star this repo if you find it useful!
813
+ </div>