summit-marker 2.0.0 → 3.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
@@ -5,110 +5,98 @@
5
5
  ![license](https://img.shields.io/npm/l/summit-marker)
6
6
  ![dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)
7
7
 
8
- ![Marker Colors Demo](https://cdn.phototourl.com/free/2026-07-26-2b052282-6e2b-469d-8358-9c12ddf38764.jpg)
8
+ ![Marker Demo](https://cdn.phototourl.com/free/2026-07-26-2b052282-6e2b-469d-8358-9c12ddf38764.jpg)
9
9
 
10
- Marker Supports **16.7 Million True Colors** With RGB and Hex Support
11
-
12
- A zero-dependency Chalk alternative for Node.js with terminal colors, chaining, RGB, hex colors, gradients, and styled messages.
13
-
14
- Built by **Summit**.
15
-
16
- ---
10
+ # Marker
17
11
 
18
- ## Quick Start
12
+ A zero-dependency terminal styling and CLI presentation toolkit for Node.js.
19
13
 
20
- ```js
21
- import marker from "summit-marker";
14
+ Marker provides everything needed to create beautiful terminal applications:
22
15
 
23
- console.log(marker.bold.green("✓ Marker is working"));
16
+ - Colors
17
+ - Styles
18
+ - RGB
19
+ - Hex colors
20
+ - True RGB gradients
21
+ - Gradient presets
22
+ - Themes
23
+ - Box formatting
24
+ - Messages
25
+ - Symbols
26
+ - Text utilities
27
+ - Progress formatting
28
+ - Terminal detection
24
29
 
25
- console.log(marker.gradient("SUMMIT"));
26
- ```
30
+ Built by **Summit**.
27
31
 
28
32
  ---
29
33
 
30
- ## Package Stats
31
-
32
- - Dependencies: 0
33
- - Runtime: Node.js
34
- - Color support: True RGB
35
- - Color range: 16,777,216 colors
36
-
37
- ## Supported
38
-
39
- - Node.js ✅
40
- - Linux terminals ✅
41
- - macOS terminals ✅
42
- - Windows terminals ✅
43
- - Termux/Android Node.js ✅
34
+ # Why Marker?
44
35
 
45
- ## Changelog
46
-
47
- ### 1.0.0
48
-
49
- - Initial release
50
- - Added colors
51
- - Added styles
52
- - Added RGB/hex support
53
- - Added gradients
54
- - Added message helpers
55
-
56
- ---
36
+ Terminal applications often need more than simple colors.
57
37
 
58
- ## Marker vs Traditional ANSI
38
+ Developers usually combine multiple libraries for:
59
39
 
60
- | Feature | Marker |
61
- |---|---|
62
- | Colors | ✅ |
63
- | RGB | ✅ |
64
- | Hex | ✅ |
65
- | Gradients | ✅ |
66
- | Chaining | ✅ |
67
- | Zero dependencies | ✅ |
68
- | Manual ANSI codes | ❌ |
40
+ - terminal colors
41
+ - message formatting
42
+ - boxes
43
+ - symbols
44
+ - progress displays
45
+ - gradients
69
46
 
70
- ---
47
+ Marker combines these features into one lightweight package.
71
48
 
72
- ## Why Marker?
49
+ Instead of writing:
73
50
 
74
- Writing terminal colors manually with ANSI escape codes is difficult and hard to read.
51
+ ```js
52
+ "\x1b[31mError\x1b[0m"
53
+ ```
75
54
 
76
- Instead of:
55
+ You can write:
77
56
 
78
57
  ```js
79
- "\x1b[31mError\x1b[0m"
58
+ marker.red("Error");
80
59
  ```
81
60
 
82
- Marker lets developers write:
61
+ Or:
83
62
 
84
63
  ```js
85
- marker.red("Error")
64
+ marker.error("Build failed");
86
65
  ```
87
66
 
88
- Marker provides a clean and modern API for creating beautiful command-line output.
67
+ Marker focuses on:
89
68
 
90
- ---
69
+ - simple APIs
70
+ - zero dependencies
71
+ - cross-platform support
72
+ - beautiful CLI output
91
73
 
92
- ## Features
74
+ ---
93
75
 
94
- - 🎨 Basic terminal colors
95
- - 🌈 Extended color palette
96
- - 🔗 Chainable styles
97
- - ✨ Bold, italic, underline, and more
98
- - 🎯 RGB true-color support
99
- - 🔢 Hex color support
100
- - 🌈 Gradient text
101
- - Success, error, warning, and info messages
102
- - 🖥️ Automatic color detection
103
- - 📦 Zero dependencies
104
- - Lightweight and fast
105
- - 🟦 TypeScript support
76
+ # Marker vs Chalk
77
+
78
+ | Feature | Marker | Chalk |
79
+ |---|---|---|
80
+ | Colors | | ✅ |
81
+ | Styles | | ✅ |
82
+ | RGB | ✅ | ✅ |
83
+ | Hex colors | | |
84
+ | True RGB gradients | ✅ | ❌ |
85
+ | Gradient presets | ✅ | ❌ |
86
+ | Themes | | ❌ |
87
+ | Box formatting | ✅ | ❌ |
88
+ | Built-in messages | ✅ | ❌ |
89
+ | Symbols API | ✅ | ❌ |
90
+ | Text utilities | ✅ | ❌ |
91
+ | Zero dependencies | ✅ | Depends on version |
92
+
93
+ Marker is designed as a complete terminal presentation toolkit.
106
94
 
107
95
  ---
108
96
 
109
- ## Installation
97
+ # Installation
110
98
 
111
- Install Marker with npm:
99
+ Install Marker using npm:
112
100
 
113
101
  ```bash
114
102
  npm install summit-marker
@@ -116,58 +104,81 @@ npm install summit-marker
116
104
 
117
105
  ---
118
106
 
119
- ## Basic Usage
107
+ # Quick Start
120
108
 
121
109
  ```js
122
110
  import marker from "summit-marker";
123
111
 
124
- console.log(marker.red("Error"));
125
- console.log(marker.green("Success"));
126
- console.log(marker.blue("Information"));
127
- ```
112
+ console.log(
113
+ marker.green("Success")
114
+ );
128
115
 
129
- ---
130
-
131
- ## TypeScript
116
+ console.log(
117
+ marker.bold.blue("Hello Marker")
118
+ );
132
119
 
133
- Marker includes TypeScript declarations.
134
-
135
- ```ts
136
- import marker from "summit-marker";
120
+ console.log(
121
+ marker.success("Installed")
122
+ );
123
+ ```
137
124
 
138
- marker.bold.blue("Hello TypeScript");
125
+ Output:
139
126
 
140
- marker.rgb(255, 0, 0)("Red");
127
+ ```
128
+ Success
129
+ Hello Marker
130
+ ✔ Installed
141
131
  ```
142
132
 
143
133
  ---
144
134
 
145
- ## Colors
135
+ # API Documentation
136
+
137
+ # Colors
146
138
 
147
- Marker includes many built-in colors:
139
+ Marker supports terminal colors:
148
140
 
149
141
  ```js
150
142
  marker.red("Red");
143
+
151
144
  marker.green("Green");
145
+
152
146
  marker.blue("Blue");
147
+
153
148
  marker.orange("Orange");
149
+
154
150
  marker.pink("Pink");
151
+
155
152
  marker.brown("Brown");
153
+
156
154
  marker.neon("Neon");
155
+ ```
157
156
 
157
+ Additional colors:
158
+
159
+ ```js
158
160
  marker.gold("Gold");
161
+
159
162
  marker.lime("Lime");
163
+
160
164
  marker.teal("Teal");
165
+
161
166
  marker.violet("Violet");
167
+
162
168
  marker.magenta("Magenta");
169
+
163
170
  marker.navy("Navy");
171
+
164
172
  marker.skyBlue("Sky Blue");
173
+
165
174
  marker.emerald("Emerald");
166
175
  ```
167
176
 
168
177
  ---
169
178
 
170
- ## Text Styles
179
+ # Styles
180
+
181
+ Marker includes text styles:
171
182
 
172
183
  ```js
173
184
  marker.bold("Bold");
@@ -177,101 +188,418 @@ marker.italic("Italic");
177
188
  marker.underline("Underline");
178
189
  ```
179
190
 
191
+ Styles can be combined:
192
+
193
+ ```js
194
+ marker.bold.red("Critical Error");
195
+
196
+ marker.underline.blue("Documentation");
197
+ ```
198
+
180
199
  ---
181
200
 
182
- ## Chaining
201
+ # Chaining
183
202
 
184
- Combine colors and styles:
203
+ Marker uses a chainable API:
185
204
 
186
205
  ```js
187
- marker.bold.red("Critical Error");
206
+ marker
207
+ .bold
208
+ .green
209
+ ("Success");
210
+ ```
188
211
 
189
- marker.underline.blue("Documentation");
212
+ Example:
190
213
 
191
- marker.neon.emerald("Success");
214
+ ```js
215
+ marker.bold.red.underline(
216
+ "Important"
217
+ );
192
218
  ```
193
219
 
194
220
  ---
195
221
 
196
- ## RGB Colors
222
+ # RGB Colors
197
223
 
198
224
  Marker supports true 24-bit RGB colors.
199
225
 
226
+ That means:
227
+
228
+ ```
229
+ 16,777,216 possible colors
230
+ ```
231
+
232
+ Example:
233
+
200
234
  ```js
201
- marker.rgb(255, 120, 0)("Custom Orange");
235
+ marker.rgb(
236
+ 255,
237
+ 120,
238
+ 0
239
+ )("Custom Orange");
202
240
  ```
203
241
 
204
- RGB supports:
242
+ ---
243
+
244
+ # Hex Colors
245
+
246
+ Use any HEX color:
205
247
 
248
+ ```js
249
+ marker.hex("#ff8800")
250
+ ("Orange");
206
251
  ```
207
- 16,777,216 possible colors
252
+
253
+ Examples:
254
+
255
+ ```js
256
+ marker.hex("#ff0000")
257
+ ("Red");
258
+
259
+ marker.hex("#00ff00")
260
+ ("Green");
261
+
262
+ marker.hex("#0000ff")
263
+ ("Blue");
208
264
  ```
209
265
 
210
266
  ---
211
267
 
212
- ## Hex Colors
268
+ # Gradients
213
269
 
214
- Use any hex color:
270
+ Marker supports multiple gradient systems.
271
+
272
+ ## Basic Gradient
215
273
 
216
274
  ```js
217
- marker.hex("#ff8800")("Custom Orange");
275
+ marker.gradient(
276
+ "SUMMIT"
277
+ );
218
278
  ```
219
279
 
220
- Examples:
280
+ ---
281
+
282
+ # True RGB Gradients
283
+
284
+ Marker supports full RGB gradients:
285
+
286
+ ```js
287
+ marker.rgbGradient(
288
+ "SUMMIT"
289
+ );
290
+ ```
291
+
292
+ Unlike limited terminal palettes, RGB gradients use true color output.
293
+
294
+ ---
295
+
296
+ # Gradient Presets
297
+
298
+ Marker includes built-in gradients:
299
+
300
+ ## Rainbow
301
+
302
+ ```js
303
+ marker.gradients.rainbow(
304
+ "RAINBOW"
305
+ );
306
+ ```
307
+
308
+ ## Sunset
309
+
310
+ ```js
311
+ marker.gradients.sunset(
312
+ "SUNSET"
313
+ );
314
+ ```
315
+
316
+ ## Ocean
317
+
318
+ ```js
319
+ marker.gradients.ocean(
320
+ "OCEAN"
321
+ );
322
+ ```
323
+
324
+ ## Fire
325
+
326
+ ```js
327
+ marker.gradients.fire(
328
+ "FIRE"
329
+ );
330
+ ```
331
+
332
+ ## Neon
333
+
334
+ ```js
335
+ marker.gradients.neon(
336
+ "NEON"
337
+ );
338
+ ```
339
+
340
+ ## Candy
341
+
342
+ ```js
343
+ marker.gradients.candy(
344
+ "CANDY"
345
+ );
346
+ ```
347
+
348
+ ## Forest
221
349
 
222
350
  ```js
223
- marker.hex("#ff0000")("Red");
351
+ marker.gradients.forest(
352
+ "FOREST"
353
+ );
354
+ ```
224
355
 
225
- marker.hex("#00ff00")("Green");
356
+ ## Ice
226
357
 
227
- marker.hex("#0000ff")("Blue");
358
+ ```js
359
+ marker.gradients.ice(
360
+ "ICE"
361
+ );
362
+ ```
363
+
364
+ ## Space
365
+
366
+ ```js
367
+ marker.gradients.space(
368
+ "SPACE"
369
+ );
228
370
  ```
229
371
 
230
372
  ---
231
373
 
232
- ## Gradients
374
+ # Themes
375
+
376
+ Marker supports themes for consistent application styling.
233
377
 
234
- Create colorful gradient text:
378
+ Example:
235
379
 
236
380
  ```js
237
- marker.gradient("SUMMIT");
381
+ const theme =
382
+ marker.themes.default;
383
+
384
+ theme.primary(
385
+ "Primary"
386
+ );
387
+
388
+ theme.success(
389
+ "Success"
390
+ );
238
391
  ```
239
392
 
393
+ Themes allow applications to define reusable styles.
394
+
240
395
  ---
241
396
 
242
- ## Messages
397
+ # Box Formatting
243
398
 
244
- Marker includes common terminal messages:
399
+ Create terminal boxes:
245
400
 
246
401
  ```js
247
- marker.success("Package installed");
402
+ marker.box(
403
+ "Hello Marker"
404
+ );
405
+ ```
248
406
 
249
- marker.error("Build failed");
407
+ Example:
408
+
409
+ ```
410
+ ┌──────────────┐
411
+ │ Hello Marker │
412
+ └──────────────┘
413
+ ```
250
414
 
251
- marker.warning("Deprecated feature");
415
+ ---
416
+
417
+ # Messages
418
+
419
+ Marker includes styled terminal messages.
420
+
421
+ ## Success
422
+
423
+ ```js
424
+ marker.success(
425
+ "Installed"
426
+ );
427
+ ```
428
+
429
+ Output:
430
+
431
+ ```
432
+ ✔ Installed
433
+ ```
434
+
435
+ ---
436
+
437
+ ## Error
438
+
439
+ ```js
440
+ marker.error(
441
+ "Failed"
442
+ );
443
+ ```
444
+
445
+ Output:
446
+
447
+ ```
448
+ ✖ Failed
449
+ ```
450
+
451
+ ---
452
+
453
+ ## Warning
454
+
455
+ ```js
456
+ marker.warning(
457
+ "Deprecated"
458
+ );
459
+ ```
460
+
461
+ Output:
462
+
463
+ ```
464
+ ⚠ Deprecated
465
+ ```
466
+
467
+ ---
468
+
469
+ ## Info
470
+
471
+ ```js
472
+ marker.info(
473
+ "Searching"
474
+ );
475
+ ```
476
+
477
+ Output:
478
+
479
+ ```
480
+ ℹ Searching
481
+ ```
482
+
483
+ ---
484
+
485
+ # Symbols
486
+
487
+ Marker provides terminal-safe symbols.
488
+
489
+ ```js
490
+ marker.symbols.success
491
+ ```
492
+
493
+ Returns:
494
+
495
+ ```
496
+
497
+ ```
498
+
499
+ Available symbols:
500
+
501
+ ```js
502
+ marker.symbols.check
503
+
504
+ marker.symbols.cross
505
+
506
+ marker.symbols.star
507
+
508
+ marker.symbols.arrowRight
509
+
510
+ marker.symbols.loading
511
+
512
+ marker.symbols.block
513
+ ```
514
+
515
+ Symbols are designed for:
516
+
517
+ - CLI interfaces
518
+ - progress bars
519
+ - spinners
520
+ - terminal tools
521
+
522
+ ---
523
+
524
+ # Text Utilities
525
+
526
+ Marker includes text transformations.
527
+
528
+ ## CAPS
252
529
 
253
- marker.info("Searching...");
530
+ ```js
531
+ marker.caps(
532
+ "hello marker"
533
+ );
534
+ ```
535
+
536
+ Output:
537
+
538
+ ```
539
+ HELLO MARKER
540
+ ```
541
+
542
+ ---
543
+
544
+ ## Lowercase
545
+
546
+ ```js
547
+ marker.lower(
548
+ "HELLO"
549
+ );
550
+ ```
551
+
552
+ Output:
553
+
554
+ ```
555
+ hello
556
+ ```
557
+
558
+ ---
559
+
560
+ ## Title Case
561
+
562
+ ```js
563
+ marker.title(
564
+ "hello marker"
565
+ );
566
+ ```
567
+
568
+ Output:
569
+
570
+ ```
571
+ Hello Marker
572
+ ```
573
+
574
+ ---
575
+
576
+ # Progress Formatting
577
+
578
+ Marker supports terminal-safe progress displays.
579
+
580
+ Example:
581
+
582
+ ```
583
+ ████████░░ 80%
254
584
  ```
255
585
 
256
- Example output:
586
+ Characters:
257
587
 
258
588
  ```
259
- Package installed
260
- Build failed
261
- ⚠ Deprecated feature
262
- ℹ Searching...
589
+ Filled
590
+ Empty
263
591
  ```
264
592
 
265
593
  ---
266
594
 
267
- ## Color Detection
595
+ # Color Detection
268
596
 
269
- Marker automatically detects terminal color support.
597
+ Marker automatically detects terminal support.
270
598
 
271
599
  ```js
272
- console.log(marker.level);
600
+ marker.level;
273
601
 
274
- console.log(marker.supportsColor);
602
+ marker.supportsColor;
275
603
  ```
276
604
 
277
605
  Levels:
@@ -280,16 +608,20 @@ Levels:
280
608
  0 - Disabled
281
609
  1 - Basic colors
282
610
  2 - 256 colors
283
- 3 - True RGB colors
611
+ 3 - True RGB
284
612
  ```
285
613
 
614
+ ---
615
+
616
+ # Environment Variables
617
+
286
618
  Disable colors:
287
619
 
288
620
  ```bash
289
621
  NO_COLOR=1 node app.js
290
622
  ```
291
623
 
292
- Force color support:
624
+ Force colors:
293
625
 
294
626
  ```bash
295
627
  FORCE_COLOR=3 node app.js
@@ -297,84 +629,144 @@ FORCE_COLOR=3 node app.js
297
629
 
298
630
  ---
299
631
 
300
- ## Example
632
+ # TypeScript
301
633
 
302
- Run:
634
+ Marker includes TypeScript support.
303
635
 
304
- ```bash
305
- node examples/BestColors.js
636
+ ```ts
637
+ import marker from "summit-marker";
638
+
639
+ marker.bold.blue(
640
+ "Hello TypeScript"
641
+ );
642
+
643
+ marker.rgb(
644
+ 255,
645
+ 0,
646
+ 0
647
+ )(
648
+ "Red"
649
+ );
306
650
  ```
307
651
 
308
- Example:
652
+ ---
309
653
 
310
- ```
311
- === Basic Colors ===
312
- Red
313
- Green
314
- Blue
315
- Orange
316
- Pink
317
- Brown
318
- Neon
654
+ # Examples
319
655
 
320
- === Styles ===
321
- Bold
322
- Italic
323
- Underline
656
+ Examples are included:
657
+
658
+ ```bash
659
+ node examples/BestColors.js
324
660
 
325
- === Chaining ===
326
- Bold Red
327
- Blue Underline
661
+ node examples/symbols.js
328
662
 
329
- === RGB ===
330
- Custom RGB Orange
663
+ node examples/gradients.js
331
664
 
332
- === HEX ===
333
- Custom Hex Purple
665
+ node examples/themes.js
334
666
 
335
- === Gradient ===
336
- SUMMIT
667
+ node examples/progress.js
337
668
  ```
338
669
 
339
670
  ---
340
671
 
341
- ## Project Structure
672
+ # Project Structure
342
673
 
343
674
  ```
344
675
  summit-marker/
676
+
345
677
  ├── src/
346
678
  │ ├── index.js
347
679
  │ ├── colors.js
348
680
  │ ├── styles.js
349
681
  │ ├── messages.js
350
- └── types.d.ts
682
+ ├── gradients.js
683
+ │ ├── rgbGradient.js
684
+ │ ├── themes.js
685
+ │ ├── box.js
686
+ │ └── text.js
687
+
351
688
  ├── examples/
352
- └── BestColors.js
689
+ ├── BestColors.js
690
+ │ ├── symbols.js
691
+ │ ├── gradients.js
692
+ │ ├── themes.js
693
+ │ └── progress.js
694
+
353
695
  ├── README.md
354
696
  └── package.json
355
697
  ```
356
698
 
357
699
  ---
358
700
 
359
- ## Technology
701
+ # Performance
702
+
703
+ Marker is built to be lightweight.
704
+
705
+ ## Zero Dependencies
706
+
707
+ Marker uses:
708
+
709
+ ```
710
+ Dependencies: 0
711
+ ```
712
+
713
+ Benefits:
714
+
715
+ - smaller installs
716
+ - fewer security risks
717
+ - faster setup
718
+ - fewer dependency conflicts
719
+
720
+ ---
721
+
722
+ # Roadmap
360
723
 
361
- Marker is built with:
724
+ Future Marker versions may include:
362
725
 
363
- - Node.js
364
- - JavaScript ES Modules
365
- - ANSI terminal formatting
366
- - TypeScript declarations
726
+ - More themes
727
+ - More terminal helpers
728
+ - Advanced progress systems
729
+ - More formatting utilities
730
+ - API improvements
731
+ - Additional CLI features
367
732
 
368
- No external dependencies are required.
733
+ ---
734
+
735
+ # Changelog
736
+
737
+ ## 3.0.0
738
+
739
+ Added:
740
+
741
+ - Theme system
742
+ - Gradient presets
743
+ - True RGB gradients
744
+ - Box formatting
745
+ - Text utilities
746
+ - Expanded symbols
747
+ - Improved CLI presentation
748
+
749
+ ## 1.0.0
750
+
751
+ Initial release:
752
+
753
+ - Colors
754
+ - Styles
755
+ - RGB
756
+ - Hex
757
+ - Gradients
758
+ - Messages
369
759
 
370
760
  ---
371
761
 
372
- ## License
762
+ # License
373
763
 
374
764
  UNLICENSED
375
765
 
376
766
  ---
377
767
 
378
- ## Built By
768
+ # Built By Summit
769
+
770
+ Marker is developed and maintained by **Summit**.
379
771
 
380
- **Summit**
772
+ Creating lightweight developer tools with simple, powerful APIs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "summit-marker",
3
- "version": "2.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Marker a zero-dependency Chalk alternative for Node.js with terminal colors, chaining, RGB, hex colors, gradients, and styled messages.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/box.js ADDED
@@ -0,0 +1,73 @@
1
+ export default function box(text, options = {}) {
2
+ const {
3
+ padding = 1,
4
+ border = "single"
5
+ } = options;
6
+
7
+ const borders = {
8
+ single: {
9
+ top: "─",
10
+ bottom: "─",
11
+ left: "│",
12
+ right: "│",
13
+ tl: "┌",
14
+ tr: "┐",
15
+ bl: "└",
16
+ br: "┘"
17
+ },
18
+
19
+ double: {
20
+ top: "═",
21
+ bottom: "═",
22
+ left: "║",
23
+ right: "║",
24
+ tl: "╔",
25
+ tr: "╗",
26
+ bl: "╚",
27
+ br: "╝"
28
+ },
29
+
30
+ round: {
31
+ top: "─",
32
+ bottom: "─",
33
+ left: "│",
34
+ right: "│",
35
+ tl: "╭",
36
+ tr: "╮",
37
+ bl: "╰",
38
+ br: "╯"
39
+ }
40
+ };
41
+
42
+ const style = borders[border] || borders.single;
43
+
44
+ const lines = String(text).split("\n");
45
+
46
+ const width =
47
+ Math.max(...lines.map(line => line.length)) +
48
+ padding * 2;
49
+
50
+ const top =
51
+ style.tl +
52
+ style.top.repeat(width) +
53
+ style.tr;
54
+
55
+ const bottom =
56
+ style.bl +
57
+ style.bottom.repeat(width) +
58
+ style.br;
59
+
60
+ const middle = lines.map(line =>
61
+ style.left +
62
+ " ".repeat(padding) +
63
+ line +
64
+ " ".repeat(width - line.length - padding) +
65
+ style.right
66
+ );
67
+
68
+ return [
69
+ top,
70
+ ...middle,
71
+ bottom
72
+ ].join("\n");
73
+ }
package/src/colors.js CHANGED
@@ -6,7 +6,7 @@ export const colors = {
6
6
  purple: "\x1b[35m",
7
7
  cyan: "\x1b[36m",
8
8
  white: "\x1b[37m",
9
- grey: "\x1b[90m",
9
+ gray: "\x1b[90m",
10
10
  black: "\x1b[30m",
11
11
 
12
12
  orange: "\x1b[38;5;208m",
@@ -0,0 +1,84 @@
1
+ // src/gradients.js
2
+
3
+ function createGradient(colors) {
4
+ return (text) => {
5
+ let output = "";
6
+
7
+ for (let i = 0; i < text.length; i++) {
8
+ const color = colors[i % colors.length];
9
+
10
+ output += `\x1b[38;5;${color}m${text[i]}`;
11
+ }
12
+
13
+ return `${output}\x1b[0m`;
14
+ };
15
+ }
16
+
17
+ export const gradients = {
18
+ rainbow: createGradient([
19
+ 196,
20
+ 208,
21
+ 226,
22
+ 46,
23
+ 51,
24
+ 21,
25
+ 129
26
+ ]),
27
+
28
+ sunset: createGradient([
29
+ 129,
30
+ 198,
31
+ 208,
32
+ 226
33
+ ]),
34
+
35
+ ocean: createGradient([
36
+ 51,
37
+ 45,
38
+ 39,
39
+ 33
40
+ ]),
41
+
42
+ fire: createGradient([
43
+ 196,
44
+ 202,
45
+ 208,
46
+ 226
47
+ ]),
48
+
49
+ neon: createGradient([
50
+ 201,
51
+ 207,
52
+ 51,
53
+ 87
54
+ ]),
55
+
56
+ candy: createGradient([
57
+ 213,
58
+ 207,
59
+ 201,
60
+ 51
61
+ ]),
62
+
63
+ forest: createGradient([
64
+ 22,
65
+ 28,
66
+ 34,
67
+ 82
68
+ ]),
69
+
70
+ ice: createGradient([
71
+ 231,
72
+ 195,
73
+ 159,
74
+ 45
75
+ ]),
76
+
77
+ space: createGradient([
78
+ 17,
79
+ 54,
80
+ 93,
81
+ 129,
82
+ 57
83
+ ])
84
+ };
package/src/index.js CHANGED
@@ -1,6 +1,11 @@
1
+ import { text } from "./text.js";
2
+ import box from "./box.js";
1
3
  import { colors, styles, rgb, hex } from "./colors.js";
2
4
  import { apply } from "./styles.js";
3
- import { messages } from "./messages.js";
5
+ import { messages, symbols } from "./messages.js";
6
+ import { gradients } from "./gradients.js";
7
+ import { rgbGradient } from "./rgbGradient.js";
8
+ import { createThemes } from "./themes.js";
4
9
 
5
10
  const marker = {};
6
11
 
@@ -42,13 +47,18 @@ for (const [name, code] of Object.entries({
42
47
  }
43
48
 
44
49
  marker.rgb = (r, g, b) => {
45
- return createChain([rgb(r, g, b)]);
50
+ return createChain([
51
+ rgb(r, g, b)
52
+ ]);
46
53
  };
47
54
 
48
55
  marker.hex = (value) => {
49
- return createChain([hex(value)]);
56
+ return createChain([
57
+ hex(value)
58
+ ]);
50
59
  };
51
60
 
61
+ // 256 color gradient
52
62
  marker.gradient = (text) => {
53
63
  if (marker.level === 0) {
54
64
  return text;
@@ -63,14 +73,34 @@ marker.gradient = (text) => {
63
73
  let output = "";
64
74
 
65
75
  for (let i = 0; i < text.length; i++) {
66
- output += `\x1b[38;5;${palette[i % palette.length]}m${text[i]}`;
76
+ output +=
77
+ `\x1b[38;5;${palette[i % palette.length]}m${text[i]}`;
67
78
  }
68
79
 
69
80
  return `${output}\x1b[0m`;
70
81
  };
71
82
 
83
+ // True RGB gradient
84
+ marker.rgbGradient = rgbGradient;
85
+
86
+ // Gradient presets
87
+ marker.gradients = gradients;
88
+
89
+ // Box formatting
90
+ marker.box = box;
91
+
92
+ // Messages
72
93
  Object.assign(marker, messages);
73
94
 
95
+ // Symbols
96
+ marker.symbols = symbols;
97
+
98
+ // Text utilities
99
+ Object.assign(marker, text);
100
+
101
+ // Themes
102
+ marker.themes = createThemes(marker);
103
+
74
104
  function getColorLevel() {
75
105
  if (process.env.NO_COLOR) {
76
106
  return 0;
@@ -92,6 +122,7 @@ function getColorLevel() {
92
122
  }
93
123
 
94
124
  marker.level = getColorLevel();
125
+
95
126
  marker.supportsColor = marker.level > 0;
96
127
 
97
128
  export default marker;
package/src/messages.js CHANGED
@@ -1,20 +1,55 @@
1
1
  import { colors } from "./colors.js";
2
2
  import { apply } from "./styles.js";
3
3
 
4
+ export const symbols = {
5
+ success: "✔",
6
+ error: "✖",
7
+ warning: "⚠",
8
+ info: "ℹ",
9
+
10
+ check: "✓",
11
+ cross: "✗",
12
+
13
+ bullet: "•",
14
+ dot: "·",
15
+
16
+ arrowRight: "→",
17
+ arrowLeft: "←",
18
+ arrowUp: "↑",
19
+ arrowDown: "↓",
20
+
21
+ plus: "+",
22
+ minus: "-",
23
+ star: "*",
24
+
25
+ pointer: ">",
26
+ pipe: "|",
27
+
28
+ loading: "⟳",
29
+
30
+ progress: "#",
31
+ empty: "-",
32
+
33
+ block: "█",
34
+ lightBlock: "░",
35
+ mediumBlock: "▒",
36
+ darkBlock: "▓"
37
+ };
38
+
4
39
  export const messages = {
5
40
  success(text) {
6
- return apply(colors.green, `✔ ${text}`);
41
+ return apply(colors.green, `${symbols.success} ${text}`);
7
42
  },
8
43
 
9
44
  error(text) {
10
- return apply(colors.red, `✖ ${text}`);
45
+ return apply(colors.red, `${symbols.error} ${text}`);
11
46
  },
12
47
 
13
48
  warning(text) {
14
- return apply(colors.yellow, `⚠ ${text}`);
49
+ return apply(colors.yellow, `${symbols.warning} ${text}`);
15
50
  },
16
51
 
17
52
  info(text) {
18
- return apply(colors.blue, `ℹ ${text}`);
53
+ return apply(colors.blue, `${symbols.info} ${text}`);
19
54
  }
20
55
  };
@@ -0,0 +1,67 @@
1
+ export function progress(options = {}) {
2
+ const {
3
+ total = 100,
4
+ label = "Progress",
5
+ width = 20
6
+ } = options;
7
+
8
+ let current = 0;
9
+ let finished = false;
10
+
11
+ function render() {
12
+ if (finished) return;
13
+
14
+ const percent = Math.min(
15
+ Math.floor((current / total) * 100),
16
+ 100
17
+ );
18
+
19
+ const filled = Math.floor(
20
+ (percent / 100) * width
21
+ );
22
+
23
+ const empty = width - filled;
24
+
25
+ const bar =
26
+ "█".repeat(filled) +
27
+ "░".repeat(empty);
28
+
29
+ process.stdout.write(
30
+ `\r${label} ${bar} ${current}/${total} ${percent}%`
31
+ );
32
+ }
33
+
34
+ function update(value) {
35
+ current = Math.min(value, total);
36
+ render();
37
+
38
+ if (current >= total) {
39
+ complete();
40
+ }
41
+ }
42
+
43
+ function increment(amount = 1) {
44
+ update(current + amount);
45
+ }
46
+
47
+ function complete() {
48
+ current = total;
49
+ render();
50
+ process.stdout.write("\n");
51
+ finished = true;
52
+ }
53
+
54
+ function stop() {
55
+ process.stdout.write("\n");
56
+ finished = true;
57
+ }
58
+
59
+ render();
60
+
61
+ return {
62
+ update,
63
+ increment,
64
+ complete,
65
+ stop
66
+ };
67
+ }
@@ -0,0 +1,48 @@
1
+ // src/rgbGradient.js
2
+
3
+ function interpolate(start, end, factor) {
4
+ return Math.round(
5
+ start + (end - start) * factor
6
+ );
7
+ }
8
+
9
+ function rgbCode(r, g, b) {
10
+ return `\x1b[38;2;${r};${g};${b}m`;
11
+ }
12
+
13
+ export function rgbGradient(start, end) {
14
+ return (text) => {
15
+ let output = "";
16
+
17
+ for (let i = 0; i < text.length; i++) {
18
+ const factor =
19
+ text.length <= 1
20
+ ? 0
21
+ : i / (text.length - 1);
22
+
23
+ const r = interpolate(
24
+ start[0],
25
+ end[0],
26
+ factor
27
+ );
28
+
29
+ const g = interpolate(
30
+ start[1],
31
+ end[1],
32
+ factor
33
+ );
34
+
35
+ const b = interpolate(
36
+ start[2],
37
+ end[2],
38
+ factor
39
+ );
40
+
41
+ output +=
42
+ rgbCode(r, g, b) +
43
+ text[i];
44
+ }
45
+
46
+ return `${output}\x1b[0m`;
47
+ };
48
+ }
package/src/text.js ADDED
@@ -0,0 +1,16 @@
1
+ export const text = {
2
+ caps(value) {
3
+ return String(value).toUpperCase();
4
+ },
5
+
6
+ lower(value) {
7
+ return String(value).toLowerCase();
8
+ },
9
+
10
+ title(value) {
11
+ return String(value)
12
+ .split(" ")
13
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
14
+ .join(" ");
15
+ }
16
+ };
package/src/themes.js ADDED
@@ -0,0 +1,25 @@
1
+ // src/themes.js
2
+
3
+ export function createThemes(marker) {
4
+ return {
5
+ success(text) {
6
+ return marker.green(`✔ ${text}`);
7
+ },
8
+
9
+ error(text) {
10
+ return marker.red(`✖ ${text}`);
11
+ },
12
+
13
+ warning(text) {
14
+ return marker.yellow(`⚠ ${text}`);
15
+ },
16
+
17
+ info(text) {
18
+ return marker.blue(`ℹ ${text}`);
19
+ },
20
+
21
+ summit(text) {
22
+ return marker.gradients.rainbow(`★ ${text}`);
23
+ }
24
+ };
25
+ }