summit-marker 1.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 +559 -176
- package/package.json +1 -1
- package/src/box.js +73 -0
- package/src/colors.js +1 -1
- package/src/gradients.js +84 -0
- package/src/index.js +35 -4
- package/src/messages.js +39 -4
- package/src/progress.js +67 -0
- package/src/rgbGradient.js +48 -0
- package/src/text.js +16 -0
- package/src/themes.js +25 -0
package/README.md
CHANGED
|
@@ -1,123 +1,102 @@
|
|
|
1
1
|
# Marker
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
███╗ ███╗ █████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
|
5
|
-
████╗ ████║██╔══██╗██╔══██╗██║ ██╔╝██╔════╝██╔══██╗
|
|
6
|
-
██╔████╔██║███████║██████╔╝█████╔╝ █████╗ ██████╔╝
|
|
7
|
-
██║╚██╔╝██║██╔══██║██╔══██╗██╔═██╗ ██╔══╝ ██╔══██╗
|
|
8
|
-
██║ ╚═╝ ██║██║ ██║██║ ██║██║ ██╗███████╗██║ ██║
|
|
9
|
-
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
|
10
|
-
|
|
11
|
-
|
|
12
3
|

|
|
13
4
|

|
|
14
5
|

|
|
15
6
|

|
|
16
7
|
|
|
17
|
-

|
|
22
9
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
---
|
|
10
|
+
# Marker
|
|
26
11
|
|
|
27
|
-
|
|
12
|
+
A zero-dependency terminal styling and CLI presentation toolkit for Node.js.
|
|
28
13
|
|
|
29
|
-
|
|
30
|
-
import marker from "summit-marker";
|
|
14
|
+
Marker provides everything needed to create beautiful terminal applications:
|
|
31
15
|
|
|
32
|
-
|
|
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
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
```
|
|
30
|
+
Built by **Summit**.
|
|
36
31
|
|
|
37
32
|
---
|
|
38
33
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
- Dependencies: 0
|
|
42
|
-
- Runtime: Node.js
|
|
43
|
-
- Color support: True RGB
|
|
44
|
-
- Color range: 16,777,216 colors
|
|
34
|
+
# Why Marker?
|
|
45
35
|
|
|
46
|
-
|
|
36
|
+
Terminal applications often need more than simple colors.
|
|
47
37
|
|
|
48
|
-
|
|
49
|
-
- Linux terminals ✅
|
|
50
|
-
- macOS terminals ✅
|
|
51
|
-
- Windows terminals ✅
|
|
52
|
-
- Termux/Android Node.js ✅
|
|
38
|
+
Developers usually combine multiple libraries for:
|
|
53
39
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
- Added styles
|
|
61
|
-
- Added RGB/hex support
|
|
62
|
-
- Added gradients
|
|
63
|
-
- Added message helpers
|
|
64
|
-
|
|
65
|
-
---
|
|
40
|
+
- terminal colors
|
|
41
|
+
- message formatting
|
|
42
|
+
- boxes
|
|
43
|
+
- symbols
|
|
44
|
+
- progress displays
|
|
45
|
+
- gradients
|
|
66
46
|
|
|
67
|
-
|
|
47
|
+
Marker combines these features into one lightweight package.
|
|
68
48
|
|
|
69
|
-
|
|
70
|
-
|---|---|
|
|
71
|
-
| Colors | ✅ |
|
|
72
|
-
| RGB | ✅ |
|
|
73
|
-
| Hex | ✅ |
|
|
74
|
-
| Gradients | ✅ |
|
|
75
|
-
| Chaining | ✅ |
|
|
76
|
-
| Zero dependencies | ✅ |
|
|
77
|
-
| Manual ANSI codes | ❌ |
|
|
49
|
+
Instead of writing:
|
|
78
50
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
Writing terminal colors manually with ANSI escape codes is difficult and hard to read.
|
|
51
|
+
```js
|
|
52
|
+
"\x1b[31mError\x1b[0m"
|
|
53
|
+
```
|
|
84
54
|
|
|
85
|
-
|
|
55
|
+
You can write:
|
|
86
56
|
|
|
87
57
|
```js
|
|
88
|
-
"
|
|
58
|
+
marker.red("Error");
|
|
89
59
|
```
|
|
90
60
|
|
|
91
|
-
|
|
61
|
+
Or:
|
|
92
62
|
|
|
93
63
|
```js
|
|
94
|
-
marker.
|
|
64
|
+
marker.error("Build failed");
|
|
95
65
|
```
|
|
96
66
|
|
|
97
|
-
Marker
|
|
67
|
+
Marker focuses on:
|
|
98
68
|
|
|
99
|
-
|
|
69
|
+
- simple APIs
|
|
70
|
+
- zero dependencies
|
|
71
|
+
- cross-platform support
|
|
72
|
+
- beautiful CLI output
|
|
100
73
|
|
|
101
|
-
|
|
74
|
+
---
|
|
102
75
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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.
|
|
115
94
|
|
|
116
95
|
---
|
|
117
96
|
|
|
118
|
-
|
|
97
|
+
# Installation
|
|
119
98
|
|
|
120
|
-
Install Marker
|
|
99
|
+
Install Marker using npm:
|
|
121
100
|
|
|
122
101
|
```bash
|
|
123
102
|
npm install summit-marker
|
|
@@ -125,58 +104,81 @@ npm install summit-marker
|
|
|
125
104
|
|
|
126
105
|
---
|
|
127
106
|
|
|
128
|
-
|
|
107
|
+
# Quick Start
|
|
129
108
|
|
|
130
109
|
```js
|
|
131
110
|
import marker from "summit-marker";
|
|
132
111
|
|
|
133
|
-
console.log(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
## TypeScript
|
|
112
|
+
console.log(
|
|
113
|
+
marker.green("Success")
|
|
114
|
+
);
|
|
141
115
|
|
|
142
|
-
|
|
116
|
+
console.log(
|
|
117
|
+
marker.bold.blue("Hello Marker")
|
|
118
|
+
);
|
|
143
119
|
|
|
144
|
-
|
|
145
|
-
|
|
120
|
+
console.log(
|
|
121
|
+
marker.success("Installed")
|
|
122
|
+
);
|
|
123
|
+
```
|
|
146
124
|
|
|
147
|
-
|
|
125
|
+
Output:
|
|
148
126
|
|
|
149
|
-
|
|
127
|
+
```
|
|
128
|
+
Success
|
|
129
|
+
Hello Marker
|
|
130
|
+
✔ Installed
|
|
150
131
|
```
|
|
151
132
|
|
|
152
133
|
---
|
|
153
134
|
|
|
154
|
-
|
|
135
|
+
# API Documentation
|
|
136
|
+
|
|
137
|
+
# Colors
|
|
155
138
|
|
|
156
|
-
Marker
|
|
139
|
+
Marker supports terminal colors:
|
|
157
140
|
|
|
158
141
|
```js
|
|
159
142
|
marker.red("Red");
|
|
143
|
+
|
|
160
144
|
marker.green("Green");
|
|
145
|
+
|
|
161
146
|
marker.blue("Blue");
|
|
147
|
+
|
|
162
148
|
marker.orange("Orange");
|
|
149
|
+
|
|
163
150
|
marker.pink("Pink");
|
|
151
|
+
|
|
164
152
|
marker.brown("Brown");
|
|
153
|
+
|
|
165
154
|
marker.neon("Neon");
|
|
155
|
+
```
|
|
166
156
|
|
|
157
|
+
Additional colors:
|
|
158
|
+
|
|
159
|
+
```js
|
|
167
160
|
marker.gold("Gold");
|
|
161
|
+
|
|
168
162
|
marker.lime("Lime");
|
|
163
|
+
|
|
169
164
|
marker.teal("Teal");
|
|
165
|
+
|
|
170
166
|
marker.violet("Violet");
|
|
167
|
+
|
|
171
168
|
marker.magenta("Magenta");
|
|
169
|
+
|
|
172
170
|
marker.navy("Navy");
|
|
171
|
+
|
|
173
172
|
marker.skyBlue("Sky Blue");
|
|
173
|
+
|
|
174
174
|
marker.emerald("Emerald");
|
|
175
175
|
```
|
|
176
176
|
|
|
177
177
|
---
|
|
178
178
|
|
|
179
|
-
|
|
179
|
+
# Styles
|
|
180
|
+
|
|
181
|
+
Marker includes text styles:
|
|
180
182
|
|
|
181
183
|
```js
|
|
182
184
|
marker.bold("Bold");
|
|
@@ -186,101 +188,418 @@ marker.italic("Italic");
|
|
|
186
188
|
marker.underline("Underline");
|
|
187
189
|
```
|
|
188
190
|
|
|
191
|
+
Styles can be combined:
|
|
192
|
+
|
|
193
|
+
```js
|
|
194
|
+
marker.bold.red("Critical Error");
|
|
195
|
+
|
|
196
|
+
marker.underline.blue("Documentation");
|
|
197
|
+
```
|
|
198
|
+
|
|
189
199
|
---
|
|
190
200
|
|
|
191
|
-
|
|
201
|
+
# Chaining
|
|
192
202
|
|
|
193
|
-
|
|
203
|
+
Marker uses a chainable API:
|
|
194
204
|
|
|
195
205
|
```js
|
|
196
|
-
marker
|
|
206
|
+
marker
|
|
207
|
+
.bold
|
|
208
|
+
.green
|
|
209
|
+
("Success");
|
|
210
|
+
```
|
|
197
211
|
|
|
198
|
-
|
|
212
|
+
Example:
|
|
199
213
|
|
|
200
|
-
|
|
214
|
+
```js
|
|
215
|
+
marker.bold.red.underline(
|
|
216
|
+
"Important"
|
|
217
|
+
);
|
|
201
218
|
```
|
|
202
219
|
|
|
203
220
|
---
|
|
204
221
|
|
|
205
|
-
|
|
222
|
+
# RGB Colors
|
|
206
223
|
|
|
207
224
|
Marker supports true 24-bit RGB colors.
|
|
208
225
|
|
|
226
|
+
That means:
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
16,777,216 possible colors
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Example:
|
|
233
|
+
|
|
209
234
|
```js
|
|
210
|
-
marker.rgb(
|
|
235
|
+
marker.rgb(
|
|
236
|
+
255,
|
|
237
|
+
120,
|
|
238
|
+
0
|
|
239
|
+
)("Custom Orange");
|
|
211
240
|
```
|
|
212
241
|
|
|
213
|
-
|
|
242
|
+
---
|
|
214
243
|
|
|
244
|
+
# Hex Colors
|
|
245
|
+
|
|
246
|
+
Use any HEX color:
|
|
247
|
+
|
|
248
|
+
```js
|
|
249
|
+
marker.hex("#ff8800")
|
|
250
|
+
("Orange");
|
|
215
251
|
```
|
|
216
|
-
|
|
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");
|
|
217
264
|
```
|
|
218
265
|
|
|
219
266
|
---
|
|
220
267
|
|
|
221
|
-
|
|
268
|
+
# Gradients
|
|
269
|
+
|
|
270
|
+
Marker supports multiple gradient systems.
|
|
222
271
|
|
|
223
|
-
|
|
272
|
+
## Basic Gradient
|
|
224
273
|
|
|
225
274
|
```js
|
|
226
|
-
marker.
|
|
275
|
+
marker.gradient(
|
|
276
|
+
"SUMMIT"
|
|
277
|
+
);
|
|
227
278
|
```
|
|
228
279
|
|
|
229
|
-
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
# True RGB Gradients
|
|
283
|
+
|
|
284
|
+
Marker supports full RGB gradients:
|
|
230
285
|
|
|
231
286
|
```js
|
|
232
|
-
marker.
|
|
287
|
+
marker.rgbGradient(
|
|
288
|
+
"SUMMIT"
|
|
289
|
+
);
|
|
290
|
+
```
|
|
233
291
|
|
|
234
|
-
|
|
292
|
+
Unlike limited terminal palettes, RGB gradients use true color output.
|
|
293
|
+
|
|
294
|
+
---
|
|
235
295
|
|
|
236
|
-
|
|
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
|
|
349
|
+
|
|
350
|
+
```js
|
|
351
|
+
marker.gradients.forest(
|
|
352
|
+
"FOREST"
|
|
353
|
+
);
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
## Ice
|
|
357
|
+
|
|
358
|
+
```js
|
|
359
|
+
marker.gradients.ice(
|
|
360
|
+
"ICE"
|
|
361
|
+
);
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Space
|
|
365
|
+
|
|
366
|
+
```js
|
|
367
|
+
marker.gradients.space(
|
|
368
|
+
"SPACE"
|
|
369
|
+
);
|
|
237
370
|
```
|
|
238
371
|
|
|
239
372
|
---
|
|
240
373
|
|
|
241
|
-
|
|
374
|
+
# Themes
|
|
242
375
|
|
|
243
|
-
|
|
376
|
+
Marker supports themes for consistent application styling.
|
|
377
|
+
|
|
378
|
+
Example:
|
|
244
379
|
|
|
245
380
|
```js
|
|
246
|
-
|
|
381
|
+
const theme =
|
|
382
|
+
marker.themes.default;
|
|
383
|
+
|
|
384
|
+
theme.primary(
|
|
385
|
+
"Primary"
|
|
386
|
+
);
|
|
387
|
+
|
|
388
|
+
theme.success(
|
|
389
|
+
"Success"
|
|
390
|
+
);
|
|
247
391
|
```
|
|
248
392
|
|
|
393
|
+
Themes allow applications to define reusable styles.
|
|
394
|
+
|
|
249
395
|
---
|
|
250
396
|
|
|
251
|
-
|
|
397
|
+
# Box Formatting
|
|
252
398
|
|
|
253
|
-
|
|
399
|
+
Create terminal boxes:
|
|
254
400
|
|
|
255
401
|
```js
|
|
256
|
-
marker.
|
|
402
|
+
marker.box(
|
|
403
|
+
"Hello Marker"
|
|
404
|
+
);
|
|
405
|
+
```
|
|
257
406
|
|
|
258
|
-
|
|
407
|
+
Example:
|
|
259
408
|
|
|
260
|
-
|
|
409
|
+
```
|
|
410
|
+
┌──────────────┐
|
|
411
|
+
│ Hello Marker │
|
|
412
|
+
└──────────────┘
|
|
413
|
+
```
|
|
261
414
|
|
|
262
|
-
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
# Messages
|
|
418
|
+
|
|
419
|
+
Marker includes styled terminal messages.
|
|
420
|
+
|
|
421
|
+
## Success
|
|
422
|
+
|
|
423
|
+
```js
|
|
424
|
+
marker.success(
|
|
425
|
+
"Installed"
|
|
426
|
+
);
|
|
263
427
|
```
|
|
264
428
|
|
|
265
|
-
|
|
429
|
+
Output:
|
|
266
430
|
|
|
267
431
|
```
|
|
268
|
-
✔
|
|
269
|
-
✖ Build failed
|
|
270
|
-
⚠ Deprecated feature
|
|
271
|
-
ℹ Searching...
|
|
432
|
+
✔ Installed
|
|
272
433
|
```
|
|
273
434
|
|
|
274
435
|
---
|
|
275
436
|
|
|
276
|
-
##
|
|
437
|
+
## Error
|
|
438
|
+
|
|
439
|
+
```js
|
|
440
|
+
marker.error(
|
|
441
|
+
"Failed"
|
|
442
|
+
);
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
Output:
|
|
277
446
|
|
|
278
|
-
|
|
447
|
+
```
|
|
448
|
+
✖ Failed
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## Warning
|
|
279
454
|
|
|
280
455
|
```js
|
|
281
|
-
|
|
456
|
+
marker.warning(
|
|
457
|
+
"Deprecated"
|
|
458
|
+
);
|
|
459
|
+
```
|
|
282
460
|
|
|
283
|
-
|
|
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
|
|
529
|
+
|
|
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%
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
Characters:
|
|
587
|
+
|
|
588
|
+
```
|
|
589
|
+
█ Filled
|
|
590
|
+
░ Empty
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
595
|
+
# Color Detection
|
|
596
|
+
|
|
597
|
+
Marker automatically detects terminal support.
|
|
598
|
+
|
|
599
|
+
```js
|
|
600
|
+
marker.level;
|
|
601
|
+
|
|
602
|
+
marker.supportsColor;
|
|
284
603
|
```
|
|
285
604
|
|
|
286
605
|
Levels:
|
|
@@ -289,16 +608,20 @@ Levels:
|
|
|
289
608
|
0 - Disabled
|
|
290
609
|
1 - Basic colors
|
|
291
610
|
2 - 256 colors
|
|
292
|
-
3 - True RGB
|
|
611
|
+
3 - True RGB
|
|
293
612
|
```
|
|
294
613
|
|
|
614
|
+
---
|
|
615
|
+
|
|
616
|
+
# Environment Variables
|
|
617
|
+
|
|
295
618
|
Disable colors:
|
|
296
619
|
|
|
297
620
|
```bash
|
|
298
621
|
NO_COLOR=1 node app.js
|
|
299
622
|
```
|
|
300
623
|
|
|
301
|
-
Force
|
|
624
|
+
Force colors:
|
|
302
625
|
|
|
303
626
|
```bash
|
|
304
627
|
FORCE_COLOR=3 node app.js
|
|
@@ -306,84 +629,144 @@ FORCE_COLOR=3 node app.js
|
|
|
306
629
|
|
|
307
630
|
---
|
|
308
631
|
|
|
309
|
-
|
|
632
|
+
# TypeScript
|
|
310
633
|
|
|
311
|
-
|
|
634
|
+
Marker includes TypeScript support.
|
|
312
635
|
|
|
313
|
-
```
|
|
314
|
-
|
|
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
|
+
);
|
|
315
650
|
```
|
|
316
651
|
|
|
317
|
-
|
|
652
|
+
---
|
|
318
653
|
|
|
319
|
-
|
|
320
|
-
=== Basic Colors ===
|
|
321
|
-
Red
|
|
322
|
-
Green
|
|
323
|
-
Blue
|
|
324
|
-
Orange
|
|
325
|
-
Pink
|
|
326
|
-
Brown
|
|
327
|
-
Neon
|
|
654
|
+
# Examples
|
|
328
655
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
656
|
+
Examples are included:
|
|
657
|
+
|
|
658
|
+
```bash
|
|
659
|
+
node examples/BestColors.js
|
|
333
660
|
|
|
334
|
-
|
|
335
|
-
Bold Red
|
|
336
|
-
Blue Underline
|
|
661
|
+
node examples/symbols.js
|
|
337
662
|
|
|
338
|
-
|
|
339
|
-
Custom RGB Orange
|
|
663
|
+
node examples/gradients.js
|
|
340
664
|
|
|
341
|
-
|
|
342
|
-
Custom Hex Purple
|
|
665
|
+
node examples/themes.js
|
|
343
666
|
|
|
344
|
-
|
|
345
|
-
SUMMIT
|
|
667
|
+
node examples/progress.js
|
|
346
668
|
```
|
|
347
669
|
|
|
348
670
|
---
|
|
349
671
|
|
|
350
|
-
|
|
672
|
+
# Project Structure
|
|
351
673
|
|
|
352
674
|
```
|
|
353
675
|
summit-marker/
|
|
676
|
+
│
|
|
354
677
|
├── src/
|
|
355
678
|
│ ├── index.js
|
|
356
679
|
│ ├── colors.js
|
|
357
680
|
│ ├── styles.js
|
|
358
681
|
│ ├── messages.js
|
|
359
|
-
│
|
|
682
|
+
│ ├── gradients.js
|
|
683
|
+
│ ├── rgbGradient.js
|
|
684
|
+
│ ├── themes.js
|
|
685
|
+
│ ├── box.js
|
|
686
|
+
│ └── text.js
|
|
687
|
+
│
|
|
360
688
|
├── examples/
|
|
361
|
-
│
|
|
689
|
+
│ ├── BestColors.js
|
|
690
|
+
│ ├── symbols.js
|
|
691
|
+
│ ├── gradients.js
|
|
692
|
+
│ ├── themes.js
|
|
693
|
+
│ └── progress.js
|
|
694
|
+
│
|
|
362
695
|
├── README.md
|
|
363
696
|
└── package.json
|
|
364
697
|
```
|
|
365
698
|
|
|
366
699
|
---
|
|
367
700
|
|
|
368
|
-
|
|
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
|
|
369
723
|
|
|
370
|
-
Marker
|
|
724
|
+
Future Marker versions may include:
|
|
371
725
|
|
|
372
|
-
-
|
|
373
|
-
-
|
|
374
|
-
-
|
|
375
|
-
-
|
|
726
|
+
- More themes
|
|
727
|
+
- More terminal helpers
|
|
728
|
+
- Advanced progress systems
|
|
729
|
+
- More formatting utilities
|
|
730
|
+
- API improvements
|
|
731
|
+
- Additional CLI features
|
|
376
732
|
|
|
377
|
-
|
|
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
|
|
378
759
|
|
|
379
760
|
---
|
|
380
761
|
|
|
381
|
-
|
|
762
|
+
# License
|
|
382
763
|
|
|
383
764
|
UNLICENSED
|
|
384
765
|
|
|
385
766
|
---
|
|
386
767
|
|
|
387
|
-
|
|
768
|
+
# Built By Summit
|
|
769
|
+
|
|
770
|
+
Marker is developed and maintained by **Summit**.
|
|
388
771
|
|
|
389
|
-
|
|
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": "
|
|
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
package/src/gradients.js
ADDED
|
@@ -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([
|
|
50
|
+
return createChain([
|
|
51
|
+
rgb(r, g, b)
|
|
52
|
+
]);
|
|
46
53
|
};
|
|
47
54
|
|
|
48
55
|
marker.hex = (value) => {
|
|
49
|
-
return createChain([
|
|
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 +=
|
|
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,
|
|
41
|
+
return apply(colors.green, `${symbols.success} ${text}`);
|
|
7
42
|
},
|
|
8
43
|
|
|
9
44
|
error(text) {
|
|
10
|
-
return apply(colors.red,
|
|
45
|
+
return apply(colors.red, `${symbols.error} ${text}`);
|
|
11
46
|
},
|
|
12
47
|
|
|
13
48
|
warning(text) {
|
|
14
|
-
return apply(colors.yellow,
|
|
49
|
+
return apply(colors.yellow, `${symbols.warning} ${text}`);
|
|
15
50
|
},
|
|
16
51
|
|
|
17
52
|
info(text) {
|
|
18
|
-
return apply(colors.blue,
|
|
53
|
+
return apply(colors.blue, `${symbols.info} ${text}`);
|
|
19
54
|
}
|
|
20
55
|
};
|
package/src/progress.js
ADDED
|
@@ -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
|
+
}
|