termpainter 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +124 -0
  3. package/dist/cjs/badge.cjs +13 -0
  4. package/dist/cjs/badge.d.cts +3 -0
  5. package/dist/cjs/badge.d.ts +3 -0
  6. package/dist/cjs/badge.d.ts.map +1 -0
  7. package/dist/cjs/badge.js.map +1 -0
  8. package/dist/cjs/box.cjs +28 -0
  9. package/dist/cjs/box.d.cts +3 -0
  10. package/dist/cjs/box.d.ts +3 -0
  11. package/dist/cjs/box.d.ts.map +1 -0
  12. package/dist/cjs/box.js.map +1 -0
  13. package/dist/cjs/codes.cjs +31 -0
  14. package/dist/cjs/codes.d.cts +24 -0
  15. package/dist/cjs/codes.d.ts +24 -0
  16. package/dist/cjs/codes.d.ts.map +1 -0
  17. package/dist/cjs/codes.js.map +1 -0
  18. package/dist/cjs/env.cjs +20 -0
  19. package/dist/cjs/env.d.cts +9 -0
  20. package/dist/cjs/env.d.ts +9 -0
  21. package/dist/cjs/env.d.ts.map +1 -0
  22. package/dist/cjs/env.js.map +1 -0
  23. package/dist/cjs/index.cjs +29 -0
  24. package/dist/cjs/index.d.cts +8 -0
  25. package/dist/cjs/index.d.ts +8 -0
  26. package/dist/cjs/index.d.ts.map +1 -0
  27. package/dist/cjs/index.js.map +1 -0
  28. package/dist/cjs/paint.cjs +51 -0
  29. package/dist/cjs/paint.d.cts +14 -0
  30. package/dist/cjs/paint.d.ts +14 -0
  31. package/dist/cjs/paint.d.ts.map +1 -0
  32. package/dist/cjs/paint.js.map +1 -0
  33. package/dist/cjs/style.cjs +51 -0
  34. package/dist/cjs/style.d.cts +14 -0
  35. package/dist/cjs/style.d.ts +14 -0
  36. package/dist/cjs/style.d.ts.map +1 -0
  37. package/dist/cjs/style.js.map +1 -0
  38. package/dist/esm/badge.js +10 -0
  39. package/dist/esm/badge.js.map +1 -0
  40. package/dist/esm/box.js +25 -0
  41. package/dist/esm/box.js.map +1 -0
  42. package/dist/esm/codes.js +28 -0
  43. package/dist/esm/codes.js.map +1 -0
  44. package/dist/esm/env.js +17 -0
  45. package/dist/esm/env.js.map +1 -0
  46. package/dist/esm/index.js +7 -0
  47. package/dist/esm/index.js.map +1 -0
  48. package/dist/esm/paint.js +46 -0
  49. package/dist/esm/paint.js.map +1 -0
  50. package/dist/esm/style.js +48 -0
  51. package/dist/esm/style.js.map +1 -0
  52. package/dist/types/badge.d.ts +3 -0
  53. package/dist/types/badge.d.ts.map +1 -0
  54. package/dist/types/box.d.ts +3 -0
  55. package/dist/types/box.d.ts.map +1 -0
  56. package/dist/types/codes.d.ts +24 -0
  57. package/dist/types/codes.d.ts.map +1 -0
  58. package/dist/types/env.d.ts +9 -0
  59. package/dist/types/env.d.ts.map +1 -0
  60. package/dist/types/index.d.ts +8 -0
  61. package/dist/types/index.d.ts.map +1 -0
  62. package/dist/types/paint.d.ts +14 -0
  63. package/dist/types/paint.d.ts.map +1 -0
  64. package/dist/types/style.d.ts +14 -0
  65. package/dist/types/style.d.ts.map +1 -0
  66. package/package.json +58 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Abdullah Hashmi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # termpainter
2
+
3
+ tired of staring at walls of plain `console.log`? termpainter gives your terminal output actual structure. colors, boxes, badges, tables, timestamps. zero dependencies, works in Node 18+ and Bun.
4
+ ```sh
5
+ npm install termpainter
6
+ ```
7
+
8
+ ![demo](./assets/demo.png)
9
+
10
+ ---
11
+
12
+ ## usage
13
+ ```ts
14
+ import { style, badge, box, paint } from 'termpainter'
15
+ ```
16
+
17
+ ### styles
18
+
19
+ the bread and butter. semantic methods so you stop hardcoding colors everywhere.
20
+ ```ts
21
+ style.success('Build complete') // ✔ green
22
+ style.error('Something went wrong') // ✖ red
23
+ style.warn('Disk usage at 87%') // ⚠ yellow
24
+ style.info('Server started on :3000') // ℹ blue
25
+ style.muted('debug: cache hit') // gray, dimmed
26
+ style.bold('Important message') // bold white
27
+ style.highlight('termpainter') // cyan
28
+ ```
29
+
30
+ ### badges
31
+
32
+ inline labels. good for status, versions, environments.
33
+ ```ts
34
+ badge('v1.0.0', 'cyan')
35
+ badge('PASS', 'green')
36
+ badge('FAIL', 'red')
37
+ badge('production', 'green')
38
+ badge('offline', 'red')
39
+ ```
40
+
41
+ ### boxes
42
+
43
+ draws a clean unicode border around anything. multiline works fine.
44
+ ```ts
45
+ box('Deploy complete\n3 services restarted\nAll checks passed', 'green')
46
+ box('Critical error\nProcess exited with code 1', 'red')
47
+ ```
48
+
49
+ ### divider
50
+
51
+ horizontal rule. useful for separating sections in long output.
52
+ ```ts
53
+ style.divider() // gray
54
+ style.divider('cyan') // pick a color
55
+ ```
56
+
57
+ ### table
58
+
59
+ aligned key-value output. great for config dumps, status checks, anything tabular.
60
+ ```ts
61
+ style.table({
62
+ Status: 'Running',
63
+ Uptime: '3d 2h 14m',
64
+ Memory: '512 MB',
65
+ Port: '3000',
66
+ Environment: 'production',
67
+ })
68
+ ```
69
+
70
+ ### timestamp
71
+
72
+ prefixes your message with the current time.
73
+ ```ts
74
+ style.timestamp('Server started') // [14:32:05] Server started
75
+ style.timestamp('Deploy complete', 'green') // timestamp in green
76
+ style.timestamp('Connection failed', 'red') // timestamp in red
77
+ ```
78
+
79
+ ### paint
80
+
81
+ low level, for when you need something the presets dont cover.
82
+ ```ts
83
+ paint('custom text', { color: 'magenta', bold: true })
84
+ paint('highlighted', { color: 'white', bg: 'blue' })
85
+ paint('soft note', { color: 'gray', italic: true, dim: true })
86
+ ```
87
+
88
+ ---
89
+
90
+ ## color support
91
+
92
+ termpainter automatically strips all ANSI codes when `NO_COLOR` is set, when running in CI, or when output is piped. your logs wont be full of broken escape sequences.
93
+ ```ts
94
+ import { isColorEnabled } from 'termpainter'
95
+
96
+ isColorEnabled() // true in an interactive terminal, false everywhere else
97
+ ```
98
+
99
+ ---
100
+
101
+ ## api
102
+
103
+ | function | description |
104
+ |---|---|
105
+ | `style.error(msg)` | red, prepends ✖ |
106
+ | `style.success(msg)` | green, prepends ✔ |
107
+ | `style.warn(msg)` | yellow, prepends ⚠ |
108
+ | `style.info(msg)` | blue, prepends ℹ |
109
+ | `style.muted(msg)` | gray, dimmed |
110
+ | `style.bold(msg)` | bold white |
111
+ | `style.highlight(msg)` | cyan |
112
+ | `style.divider(color?)` | 40 char horizontal rule, default gray |
113
+ | `style.table(data, color?)` | aligned key-value table, keys in cyan |
114
+ | `style.timestamp(msg, color?)` | prepends [HH:MM:SS], default gray |
115
+ | `badge(text, color?)` | [text] in chosen color, default white |
116
+ | `box(text, color?)` | unicode border box, multiline aware |
117
+ | `paint(text, options?)` | raw ANSI composer |
118
+ | `isColorEnabled()` | returns true if colors are active |
119
+
120
+ ---
121
+
122
+ ## license
123
+
124
+ MIT © Abdullah Hashmi
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.badge = badge;
4
+ const paint_js_1 = require('./paint.cjs');
5
+ const codes_js_1 = require('./codes.cjs');
6
+ const env_js_1 = require('./env.cjs');
7
+ function badge(text, color = 'white') {
8
+ if (!(0, env_js_1.isColorEnabled)())
9
+ return `[${text}]`;
10
+ const code = paint_js_1.fgMap[color];
11
+ return `${code}[${text}]${codes_js_1.RESET}`;
12
+ }
13
+ //# sourceMappingURL=badge.js.map
@@ -0,0 +1,3 @@
1
+ import { type Color } from './paint.js';
2
+ export declare function badge(text: string, color?: Color): string;
3
+ //# sourceMappingURL=badge.d.ts.map
@@ -0,0 +1,3 @@
1
+ import { type Color } from './paint.js';
2
+ export declare function badge(text: string, color?: Color): string;
3
+ //# sourceMappingURL=badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/badge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AAI/C,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,KAAe,GAAG,MAAM,CAIlE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/badge.ts"],"names":[],"mappings":";;AAIA,sBAIC;AARD,yCAA+C;AAC/C,yCAAmC;AACnC,qCAA0C;AAE1C,SAAgB,KAAK,CAAC,IAAY,EAAE,QAAe,OAAO;IACxD,IAAI,CAAC,IAAA,uBAAc,GAAE;QAAE,OAAO,IAAI,IAAI,GAAG,CAAC;IAC1C,MAAM,IAAI,GAAG,gBAAK,CAAC,KAAK,CAAC,CAAC;IAC1B,OAAO,GAAG,IAAI,IAAI,IAAI,IAAI,gBAAK,EAAE,CAAC;AACpC,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.box = box;
4
+ const paint_js_1 = require('./paint.cjs');
5
+ const codes_js_1 = require('./codes.cjs');
6
+ const env_js_1 = require('./env.cjs');
7
+ function box(text, color = 'white') {
8
+ const lines = text.split('\n');
9
+ const width = Math.max(...lines.map((l) => l.length));
10
+ if (!(0, env_js_1.isColorEnabled)()) {
11
+ const top = `╭${'─'.repeat(width + 2)}╮`;
12
+ const bottom = `╰${'─'.repeat(width + 2)}╯`;
13
+ const middle = lines.map((line) => {
14
+ const padding = ' '.repeat(width - line.length);
15
+ return `│ ${line}${padding} │`;
16
+ });
17
+ return [top, ...middle, bottom].join('\n');
18
+ }
19
+ const c = paint_js_1.fgMap[color];
20
+ const top = `${c}╭${'─'.repeat(width + 2)}╮${codes_js_1.RESET}`;
21
+ const bottom = `${c}╰${'─'.repeat(width + 2)}╯${codes_js_1.RESET}`;
22
+ const middle = lines.map((line) => {
23
+ const padding = ' '.repeat(width - line.length);
24
+ return `${c}│${codes_js_1.RESET} ${line}${padding} ${c}│${codes_js_1.RESET}`;
25
+ });
26
+ return [top, ...middle, bottom].join('\n');
27
+ }
28
+ //# sourceMappingURL=box.js.map
@@ -0,0 +1,3 @@
1
+ import { type Color } from './paint.js';
2
+ export declare function box(text: string, color?: Color): string;
3
+ //# sourceMappingURL=box.d.ts.map
@@ -0,0 +1,3 @@
1
+ import { type Color } from './paint.js';
2
+ export declare function box(text: string, color?: Color): string;
3
+ //# sourceMappingURL=box.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../src/box.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AAI/C,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,KAAe,GAAG,MAAM,CAuBhE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"box.js","sourceRoot":"","sources":["../../src/box.ts"],"names":[],"mappings":";;AAIA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IAAI,EAAE,EAAE;QAChC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QAChD,OAAO,GAAG,CAAC,IAAI,gBAAK,IAAI,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,gBAAK,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,EAAE,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BG_GRAY = exports.BG_WHITE = exports.BG_CYAN = exports.BG_MAGENTA = exports.BG_BLUE = exports.BG_YELLOW = exports.BG_GREEN = exports.BG_RED = exports.BG_BLACK = exports.GRAY = exports.WHITE = exports.CYAN = exports.MAGENTA = exports.BLUE = exports.YELLOW = exports.GREEN = exports.RED = exports.BLACK = exports.UNDERLINE = exports.ITALIC = exports.DIM = exports.BOLD = exports.RESET = void 0;
4
+ // Reset
5
+ exports.RESET = '\x1b[0m';
6
+ // Text styles
7
+ exports.BOLD = '\x1b[1m';
8
+ exports.DIM = '\x1b[2m';
9
+ exports.ITALIC = '\x1b[3m';
10
+ exports.UNDERLINE = '\x1b[4m';
11
+ // Foreground colors
12
+ exports.BLACK = '\x1b[30m';
13
+ exports.RED = '\x1b[31m';
14
+ exports.GREEN = '\x1b[32m';
15
+ exports.YELLOW = '\x1b[33m';
16
+ exports.BLUE = '\x1b[34m';
17
+ exports.MAGENTA = '\x1b[35m';
18
+ exports.CYAN = '\x1b[36m';
19
+ exports.WHITE = '\x1b[37m';
20
+ exports.GRAY = '\x1b[90m';
21
+ // Background colors
22
+ exports.BG_BLACK = '\x1b[40m';
23
+ exports.BG_RED = '\x1b[41m';
24
+ exports.BG_GREEN = '\x1b[42m';
25
+ exports.BG_YELLOW = '\x1b[43m';
26
+ exports.BG_BLUE = '\x1b[44m';
27
+ exports.BG_MAGENTA = '\x1b[45m';
28
+ exports.BG_CYAN = '\x1b[46m';
29
+ exports.BG_WHITE = '\x1b[47m';
30
+ exports.BG_GRAY = '\x1b[100m';
31
+ //# sourceMappingURL=codes.js.map
@@ -0,0 +1,24 @@
1
+ export declare const RESET = "\u001B[0m";
2
+ export declare const BOLD = "\u001B[1m";
3
+ export declare const DIM = "\u001B[2m";
4
+ export declare const ITALIC = "\u001B[3m";
5
+ export declare const UNDERLINE = "\u001B[4m";
6
+ export declare const BLACK = "\u001B[30m";
7
+ export declare const RED = "\u001B[31m";
8
+ export declare const GREEN = "\u001B[32m";
9
+ export declare const YELLOW = "\u001B[33m";
10
+ export declare const BLUE = "\u001B[34m";
11
+ export declare const MAGENTA = "\u001B[35m";
12
+ export declare const CYAN = "\u001B[36m";
13
+ export declare const WHITE = "\u001B[37m";
14
+ export declare const GRAY = "\u001B[90m";
15
+ export declare const BG_BLACK = "\u001B[40m";
16
+ export declare const BG_RED = "\u001B[41m";
17
+ export declare const BG_GREEN = "\u001B[42m";
18
+ export declare const BG_YELLOW = "\u001B[43m";
19
+ export declare const BG_BLUE = "\u001B[44m";
20
+ export declare const BG_MAGENTA = "\u001B[45m";
21
+ export declare const BG_CYAN = "\u001B[46m";
22
+ export declare const BG_WHITE = "\u001B[47m";
23
+ export declare const BG_GRAY = "\u001B[100m";
24
+ //# sourceMappingURL=codes.d.ts.map
@@ -0,0 +1,24 @@
1
+ export declare const RESET = "\u001B[0m";
2
+ export declare const BOLD = "\u001B[1m";
3
+ export declare const DIM = "\u001B[2m";
4
+ export declare const ITALIC = "\u001B[3m";
5
+ export declare const UNDERLINE = "\u001B[4m";
6
+ export declare const BLACK = "\u001B[30m";
7
+ export declare const RED = "\u001B[31m";
8
+ export declare const GREEN = "\u001B[32m";
9
+ export declare const YELLOW = "\u001B[33m";
10
+ export declare const BLUE = "\u001B[34m";
11
+ export declare const MAGENTA = "\u001B[35m";
12
+ export declare const CYAN = "\u001B[36m";
13
+ export declare const WHITE = "\u001B[37m";
14
+ export declare const GRAY = "\u001B[90m";
15
+ export declare const BG_BLACK = "\u001B[40m";
16
+ export declare const BG_RED = "\u001B[41m";
17
+ export declare const BG_GREEN = "\u001B[42m";
18
+ export declare const BG_YELLOW = "\u001B[43m";
19
+ export declare const BG_BLUE = "\u001B[44m";
20
+ export declare const BG_MAGENTA = "\u001B[45m";
21
+ export declare const BG_CYAN = "\u001B[46m";
22
+ export declare const BG_WHITE = "\u001B[47m";
23
+ export declare const BG_GRAY = "\u001B[100m";
24
+ //# sourceMappingURL=codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../src/codes.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,KAAK,cAAY,CAAC;AAG/B,eAAO,MAAM,IAAI,cAAY,CAAC;AAC9B,eAAO,MAAM,GAAG,cAAY,CAAC;AAC7B,eAAO,MAAM,MAAM,cAAY,CAAC;AAChC,eAAO,MAAM,SAAS,cAAY,CAAC;AAGnC,eAAO,MAAM,KAAK,eAAa,CAAC;AAChC,eAAO,MAAM,GAAG,eAAa,CAAC;AAC9B,eAAO,MAAM,KAAK,eAAa,CAAC;AAChC,eAAO,MAAM,MAAM,eAAa,CAAC;AACjC,eAAO,MAAM,IAAI,eAAa,CAAC;AAC/B,eAAO,MAAM,OAAO,eAAa,CAAC;AAClC,eAAO,MAAM,IAAI,eAAa,CAAC;AAC/B,eAAO,MAAM,KAAK,eAAa,CAAC;AAChC,eAAO,MAAM,IAAI,eAAa,CAAC;AAG/B,eAAO,MAAM,QAAQ,eAAa,CAAC;AACnC,eAAO,MAAM,MAAM,eAAa,CAAC;AACjC,eAAO,MAAM,QAAQ,eAAa,CAAC;AACnC,eAAO,MAAM,SAAS,eAAa,CAAC;AACpC,eAAO,MAAM,OAAO,eAAa,CAAC;AAClC,eAAO,MAAM,UAAU,eAAa,CAAC;AACrC,eAAO,MAAM,OAAO,eAAa,CAAC;AAClC,eAAO,MAAM,QAAQ,eAAa,CAAC;AACnC,eAAO,MAAM,OAAO,gBAAc,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codes.js","sourceRoot":"","sources":["../../src/codes.ts"],"names":[],"mappings":";;;AAAA,QAAQ;AACK,QAAA,KAAK,GAAG,SAAS,CAAC;AAE/B,cAAc;AACD,QAAA,IAAI,GAAG,SAAS,CAAC;AACjB,QAAA,GAAG,GAAG,SAAS,CAAC;AAChB,QAAA,MAAM,GAAG,SAAS,CAAC;AACnB,QAAA,SAAS,GAAG,SAAS,CAAC;AAEnC,oBAAoB;AACP,QAAA,KAAK,GAAG,UAAU,CAAC;AACnB,QAAA,GAAG,GAAG,UAAU,CAAC;AACjB,QAAA,KAAK,GAAG,UAAU,CAAC;AACnB,QAAA,MAAM,GAAG,UAAU,CAAC;AACpB,QAAA,IAAI,GAAG,UAAU,CAAC;AAClB,QAAA,OAAO,GAAG,UAAU,CAAC;AACrB,QAAA,IAAI,GAAG,UAAU,CAAC;AAClB,QAAA,KAAK,GAAG,UAAU,CAAC;AACnB,QAAA,IAAI,GAAG,UAAU,CAAC;AAE/B,oBAAoB;AACP,QAAA,QAAQ,GAAG,UAAU,CAAC;AACtB,QAAA,MAAM,GAAG,UAAU,CAAC;AACpB,QAAA,QAAQ,GAAG,UAAU,CAAC;AACtB,QAAA,SAAS,GAAG,UAAU,CAAC;AACvB,QAAA,OAAO,GAAG,UAAU,CAAC;AACrB,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,OAAO,GAAG,UAAU,CAAC;AACrB,QAAA,QAAQ,GAAG,UAAU,CAAC;AACtB,QAAA,OAAO,GAAG,WAAW,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isColorEnabled = isColorEnabled;
4
+ /**
5
+ * Returns true if ANSI color codes should be emitted.
6
+ * Colors are disabled when any of the following are true:
7
+ * - NO_COLOR env var is set (https://no-color.org)
8
+ * - CI env var is set (raw escape codes look broken in most CI logs)
9
+ * - process.stdout.isTTY is false/undefined (output is being piped)
10
+ */
11
+ function isColorEnabled() {
12
+ if (process.env.NO_COLOR !== undefined)
13
+ return false;
14
+ if (process.env.CI !== undefined)
15
+ return false;
16
+ if (!process.stdout.isTTY)
17
+ return false;
18
+ return true;
19
+ }
20
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns true if ANSI color codes should be emitted.
3
+ * Colors are disabled when any of the following are true:
4
+ * - NO_COLOR env var is set (https://no-color.org)
5
+ * - CI env var is set (raw escape codes look broken in most CI logs)
6
+ * - process.stdout.isTTY is false/undefined (output is being piped)
7
+ */
8
+ export declare function isColorEnabled(): boolean;
9
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns true if ANSI color codes should be emitted.
3
+ * Colors are disabled when any of the following are true:
4
+ * - NO_COLOR env var is set (https://no-color.org)
5
+ * - CI env var is set (raw escape codes look broken in most CI logs)
6
+ * - process.stdout.isTTY is false/undefined (output is being piped)
7
+ */
8
+ export declare function isColorEnabled(): boolean;
9
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAKxC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":";;AAOA,wCAKC;AAZD;;;;;;GAMG;AACH,SAAgB,cAAc;IAC5B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACrD,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC/C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACxC,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.isColorEnabled = exports.box = exports.badge = exports.style = exports.paint = void 0;
18
+ var paint_js_1 = require('./paint.cjs');
19
+ Object.defineProperty(exports, "paint", { enumerable: true, get: function () { return paint_js_1.paint; } });
20
+ var style_js_1 = require('./style.cjs');
21
+ Object.defineProperty(exports, "style", { enumerable: true, get: function () { return style_js_1.style; } });
22
+ var badge_js_1 = require('./badge.cjs');
23
+ Object.defineProperty(exports, "badge", { enumerable: true, get: function () { return badge_js_1.badge; } });
24
+ var box_js_1 = require('./box.cjs');
25
+ Object.defineProperty(exports, "box", { enumerable: true, get: function () { return box_js_1.box; } });
26
+ var env_js_1 = require('./env.cjs');
27
+ Object.defineProperty(exports, "isColorEnabled", { enumerable: true, get: function () { return env_js_1.isColorEnabled; } });
28
+ __exportStar(require('./codes.cjs'), exports);
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,8 @@
1
+ export { paint } from './paint.js';
2
+ export type { PaintOptions, Color } from './paint.js';
3
+ export { style } from './style.js';
4
+ export { badge } from './badge.js';
5
+ export { box } from './box.js';
6
+ export { isColorEnabled } from './env.js';
7
+ export * from './codes.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,8 @@
1
+ export { paint } from './paint.js';
2
+ export type { PaintOptions, Color } from './paint.js';
3
+ export { style } from './style.js';
4
+ export { badge } from './badge.js';
5
+ export { box } from './box.js';
6
+ export { isColorEnabled } from './env.js';
7
+ export * from './codes.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,cAAc,YAAY,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uCAAmC;AAA1B,iGAAA,KAAK,OAAA;AAEd,uCAAmC;AAA1B,iGAAA,KAAK,OAAA;AACd,uCAAmC;AAA1B,iGAAA,KAAK,OAAA;AACd,mCAA+B;AAAtB,6FAAA,GAAG,OAAA;AACZ,mCAA0C;AAAjC,wGAAA,cAAc,OAAA;AACvB,6CAA2B"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bgMap = exports.fgMap = void 0;
4
+ exports.paint = paint;
5
+ const codes_js_1 = require('./codes.cjs');
6
+ const env_js_1 = require('./env.cjs');
7
+ const fgMap = {
8
+ black: codes_js_1.BLACK,
9
+ red: codes_js_1.RED,
10
+ green: codes_js_1.GREEN,
11
+ yellow: codes_js_1.YELLOW,
12
+ blue: codes_js_1.BLUE,
13
+ magenta: codes_js_1.MAGENTA,
14
+ cyan: codes_js_1.CYAN,
15
+ white: codes_js_1.WHITE,
16
+ gray: codes_js_1.GRAY,
17
+ };
18
+ exports.fgMap = fgMap;
19
+ const bgMap = {
20
+ black: codes_js_1.BG_BLACK,
21
+ red: codes_js_1.BG_RED,
22
+ green: codes_js_1.BG_GREEN,
23
+ yellow: codes_js_1.BG_YELLOW,
24
+ blue: codes_js_1.BG_BLUE,
25
+ magenta: codes_js_1.BG_MAGENTA,
26
+ cyan: codes_js_1.BG_CYAN,
27
+ white: codes_js_1.BG_WHITE,
28
+ gray: codes_js_1.BG_GRAY,
29
+ };
30
+ exports.bgMap = bgMap;
31
+ function paint(text, options = {}) {
32
+ if (!(0, env_js_1.isColorEnabled)())
33
+ return text;
34
+ let prefix = '';
35
+ if (options.bold)
36
+ prefix += codes_js_1.BOLD;
37
+ if (options.dim)
38
+ prefix += codes_js_1.DIM;
39
+ if (options.italic)
40
+ prefix += codes_js_1.ITALIC;
41
+ if (options.underline)
42
+ prefix += codes_js_1.UNDERLINE;
43
+ if (options.color)
44
+ prefix += fgMap[options.color];
45
+ if (options.bg)
46
+ prefix += bgMap[options.bg];
47
+ if (!prefix)
48
+ return text;
49
+ return `${prefix}${text}${codes_js_1.RESET}`;
50
+ }
51
+ //# sourceMappingURL=paint.js.map
@@ -0,0 +1,14 @@
1
+ export type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray';
2
+ export interface PaintOptions {
3
+ color?: Color;
4
+ bg?: Color;
5
+ bold?: boolean;
6
+ dim?: boolean;
7
+ italic?: boolean;
8
+ underline?: boolean;
9
+ }
10
+ declare const fgMap: Record<Color, string>;
11
+ declare const bgMap: Record<Color, string>;
12
+ export declare function paint(text: string, options?: PaintOptions): string;
13
+ export { fgMap, bgMap };
14
+ //# sourceMappingURL=paint.d.ts.map
@@ -0,0 +1,14 @@
1
+ export type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray';
2
+ export interface PaintOptions {
3
+ color?: Color;
4
+ bg?: Color;
5
+ bold?: boolean;
6
+ dim?: boolean;
7
+ italic?: boolean;
8
+ underline?: boolean;
9
+ }
10
+ declare const fgMap: Record<Color, string>;
11
+ declare const bgMap: Record<Color, string>;
12
+ export declare function paint(text: string, options?: PaintOptions): string;
13
+ export { fgMap, bgMap };
14
+ //# sourceMappingURL=paint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paint.d.ts","sourceRoot":"","sources":["../../src/paint.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAE1G,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,EAAE,CAAC,EAAE,KAAK,CAAC;IACX,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,QAAA,MAAM,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAUhC,CAAC;AAEF,QAAA,MAAM,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAUhC,CAAC;AAEF,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,MAAM,CAWtE;AAED,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paint.js","sourceRoot":"","sources":["../../src/paint.ts"],"names":[],"mappings":";;;AA0CA,sBAWC;AArDD,yCAIoB;AACpB,qCAA0C;AAa1C,MAAM,KAAK,GAA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1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.style = void 0;
4
+ const paint_js_1 = require('./paint.cjs');
5
+ exports.style = {
6
+ error(msg) {
7
+ return (0, paint_js_1.paint)(`✖ ${msg}`, { color: 'red' });
8
+ },
9
+ success(msg) {
10
+ return (0, paint_js_1.paint)(`✔ ${msg}`, { color: 'green' });
11
+ },
12
+ warn(msg) {
13
+ return (0, paint_js_1.paint)(`⚠ ${msg}`, { color: 'yellow' });
14
+ },
15
+ info(msg) {
16
+ return (0, paint_js_1.paint)(`ℹ ${msg}`, { color: 'blue' });
17
+ },
18
+ muted(msg) {
19
+ return (0, paint_js_1.paint)(msg, { color: 'gray', dim: true });
20
+ },
21
+ bold(msg) {
22
+ return (0, paint_js_1.paint)(msg, { color: 'white', bold: true });
23
+ },
24
+ highlight(msg) {
25
+ return (0, paint_js_1.paint)(msg, { color: 'cyan' });
26
+ },
27
+ divider(color = 'gray') {
28
+ return (0, paint_js_1.paint)('─'.repeat(40), { color });
29
+ },
30
+ table(data, color = 'cyan') {
31
+ const keys = Object.keys(data);
32
+ if (keys.length === 0)
33
+ return '';
34
+ const keyWidth = Math.max(...keys.map((k) => k.length));
35
+ return keys
36
+ .map((key) => {
37
+ const paddedKey = key.padEnd(keyWidth);
38
+ return `${(0, paint_js_1.paint)(paddedKey, { color })} ${data[key]}`;
39
+ })
40
+ .join('\n');
41
+ },
42
+ timestamp(msg, color = 'gray') {
43
+ const now = new Date();
44
+ const hh = String(now.getHours()).padStart(2, '0');
45
+ const mm = String(now.getMinutes()).padStart(2, '0');
46
+ const ss = String(now.getSeconds()).padStart(2, '0');
47
+ const prefix = (0, paint_js_1.paint)(`[${hh}:${mm}:${ss}]`, { color });
48
+ return `${prefix} ${msg}`;
49
+ },
50
+ };
51
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1,14 @@
1
+ import { type Color } from './paint.js';
2
+ export declare const style: {
3
+ error(msg: string): string;
4
+ success(msg: string): string;
5
+ warn(msg: string): string;
6
+ info(msg: string): string;
7
+ muted(msg: string): string;
8
+ bold(msg: string): string;
9
+ highlight(msg: string): string;
10
+ divider(color?: Color): string;
11
+ table(data: Record<string, string>, color?: Color): string;
12
+ timestamp(msg: string, color?: Color): string;
13
+ };
14
+ //# sourceMappingURL=style.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { type Color } from './paint.js';
2
+ export declare const style: {
3
+ error(msg: string): string;
4
+ success(msg: string): string;
5
+ warn(msg: string): string;
6
+ info(msg: string): string;
7
+ muted(msg: string): string;
8
+ bold(msg: string): string;
9
+ highlight(msg: string): string;
10
+ divider(color?: Color): string;
11
+ table(data: Record<string, string>, color?: Color): string;
12
+ timestamp(msg: string, color?: Color): string;
13
+ };
14
+ //# sourceMappingURL=style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAE/C,eAAO,MAAM,KAAK;eACL,MAAM,GAAG,MAAM;iBAGb,MAAM,GAAG,MAAM;cAGlB,MAAM,GAAG,MAAM;cAGf,MAAM,GAAG,MAAM;eAGd,MAAM,GAAG,MAAM;cAGhB,MAAM,GAAG,MAAM;mBAGV,MAAM,GAAG,MAAM;oBAIf,KAAK,GAAY,MAAM;gBAI1B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAAS,KAAK,GAAY,MAAM;mBAYnD,MAAM,UAAS,KAAK,GAAY,MAAM;CAQtD,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/style.ts"],"names":[],"mappings":";;;AAAA,yCAA+C;AAElC,QAAA,KAAK,GAAG;IACnB,KAAK,CAAC,GAAW;QACf,OAAO,IAAA,gBAAK,EAAC,KAAK,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7C,CAAC;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AAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QACxD,OAAO,IAAI;aACR,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACX,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACvC,OAAO,GAAG,IAAA,gBAAK,EAAC,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACxD,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED,SAAS,CAAC,GAAW,EAAE,QAAe,MAAM;QAC1C,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACnD,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACrD,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,IAAA,gBAAK,EAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACvD,OAAO,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC;IAC5B,CAAC;CACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { fgMap } from './paint.js';
2
+ import { RESET } from './codes.js';
3
+ import { isColorEnabled } from './env.js';
4
+ export function badge(text, color = 'white') {
5
+ if (!isColorEnabled())
6
+ return `[${text}]`;
7
+ const code = fgMap[color];
8
+ return `${code}[${text}]${RESET}`;
9
+ }
10
+ //# sourceMappingURL=badge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/badge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,UAAU,KAAK,CAAC,IAAY,EAAE,QAAe,OAAO;IACxD,IAAI,CAAC,cAAc,EAAE;QAAE,OAAO,IAAI,IAAI,GAAG,CAAC;IAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1B,OAAO,GAAG,IAAI,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;AACpC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { fgMap } from './paint.js';
2
+ import { RESET } from './codes.js';
3
+ import { isColorEnabled } from './env.js';
4
+ export function box(text, color = 'white') {
5
+ const lines = text.split('\n');
6
+ const width = Math.max(...lines.map((l) => l.length));
7
+ if (!isColorEnabled()) {
8
+ const top = `╭${'─'.repeat(width + 2)}╮`;
9
+ const bottom = `╰${'─'.repeat(width + 2)}╯`;
10
+ const middle = lines.map((line) => {
11
+ const padding = ' '.repeat(width - line.length);
12
+ return `│ ${line}${padding} │`;
13
+ });
14
+ return [top, ...middle, bottom].join('\n');
15
+ }
16
+ const c = fgMap[color];
17
+ const top = `${c}╭${'─'.repeat(width + 2)}╮${RESET}`;
18
+ const bottom = `${c}╰${'─'.repeat(width + 2)}╯${RESET}`;
19
+ const middle = lines.map((line) => {
20
+ const padding = ' '.repeat(width - line.length);
21
+ return `${c}│${RESET} ${line}${padding} ${c}│${RESET}`;
22
+ });
23
+ return [top, ...middle, bottom].join('\n');
24
+ }
25
+ //# sourceMappingURL=box.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"box.js","sourceRoot":"","sources":["../../src/box.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,EAAE,MAAM,YAAY,CAAC;AAC/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,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAChC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QAChD,OAAO,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,EAAE,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,28 @@
1
+ // Reset
2
+ export const RESET = '\x1b[0m';
3
+ // Text styles
4
+ export const BOLD = '\x1b[1m';
5
+ export const DIM = '\x1b[2m';
6
+ export const ITALIC = '\x1b[3m';
7
+ export const UNDERLINE = '\x1b[4m';
8
+ // Foreground colors
9
+ export const BLACK = '\x1b[30m';
10
+ export const RED = '\x1b[31m';
11
+ export const GREEN = '\x1b[32m';
12
+ export const YELLOW = '\x1b[33m';
13
+ export const BLUE = '\x1b[34m';
14
+ export const MAGENTA = '\x1b[35m';
15
+ export const CYAN = '\x1b[36m';
16
+ export const WHITE = '\x1b[37m';
17
+ export const GRAY = '\x1b[90m';
18
+ // Background colors
19
+ export const BG_BLACK = '\x1b[40m';
20
+ export const BG_RED = '\x1b[41m';
21
+ export const BG_GREEN = '\x1b[42m';
22
+ export const BG_YELLOW = '\x1b[43m';
23
+ export const BG_BLUE = '\x1b[44m';
24
+ export const BG_MAGENTA = '\x1b[45m';
25
+ export const BG_CYAN = '\x1b[46m';
26
+ export const BG_WHITE = '\x1b[47m';
27
+ export const BG_GRAY = '\x1b[100m';
28
+ //# sourceMappingURL=codes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codes.js","sourceRoot":"","sources":["../../src/codes.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC;AAE/B,cAAc;AACd,MAAM,CAAC,MAAM,IAAI,GAAG,SAAS,CAAC;AAC9B,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC;AAC7B,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC;AAChC,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC;AAEnC,oBAAoB;AACpB,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC;AAChC,MAAM,CAAC,MAAM,GAAG,GAAG,UAAU,CAAC;AAC9B,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC;AAChC,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC;AACjC,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC;AAC/B,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAClC,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC;AAC/B,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC;AAChC,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC;AAE/B,oBAAoB;AACpB,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;AACnC,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC;AACjC,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;AACnC,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;AACpC,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAClC,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;AACrC,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAClC,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;AACnC,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Returns true if ANSI color codes should be emitted.
3
+ * Colors are disabled when any of the following are true:
4
+ * - NO_COLOR env var is set (https://no-color.org)
5
+ * - CI env var is set (raw escape codes look broken in most CI logs)
6
+ * - process.stdout.isTTY is false/undefined (output is being piped)
7
+ */
8
+ export function isColorEnabled() {
9
+ if (process.env.NO_COLOR !== undefined)
10
+ return false;
11
+ if (process.env.CI !== undefined)
12
+ return false;
13
+ if (!process.stdout.isTTY)
14
+ return false;
15
+ return true;
16
+ }
17
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,cAAc;IAC5B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACrD,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC/C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACxC,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { paint } from './paint.js';
2
+ export { style } from './style.js';
3
+ export { badge } from './badge.js';
4
+ export { box } from './box.js';
5
+ export { isColorEnabled } from './env.js';
6
+ export * from './codes.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,cAAc,YAAY,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { RESET, BOLD, DIM, ITALIC, UNDERLINE, BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, GRAY, BG_BLACK, BG_RED, BG_GREEN, BG_YELLOW, BG_BLUE, BG_MAGENTA, BG_CYAN, BG_WHITE, BG_GRAY, } from './codes.js';
2
+ import { isColorEnabled } from './env.js';
3
+ const fgMap = {
4
+ black: BLACK,
5
+ red: RED,
6
+ green: GREEN,
7
+ yellow: YELLOW,
8
+ blue: BLUE,
9
+ magenta: MAGENTA,
10
+ cyan: CYAN,
11
+ white: WHITE,
12
+ gray: GRAY,
13
+ };
14
+ const bgMap = {
15
+ black: BG_BLACK,
16
+ red: BG_RED,
17
+ green: BG_GREEN,
18
+ yellow: BG_YELLOW,
19
+ blue: BG_BLUE,
20
+ magenta: BG_MAGENTA,
21
+ cyan: BG_CYAN,
22
+ white: BG_WHITE,
23
+ gray: BG_GRAY,
24
+ };
25
+ export function paint(text, options = {}) {
26
+ if (!isColorEnabled())
27
+ return text;
28
+ let prefix = '';
29
+ if (options.bold)
30
+ prefix += BOLD;
31
+ if (options.dim)
32
+ prefix += DIM;
33
+ if (options.italic)
34
+ prefix += ITALIC;
35
+ if (options.underline)
36
+ prefix += UNDERLINE;
37
+ if (options.color)
38
+ prefix += fgMap[options.color];
39
+ if (options.bg)
40
+ prefix += bgMap[options.bg];
41
+ if (!prefix)
42
+ return text;
43
+ return `${prefix}${text}${RESET}`;
44
+ }
45
+ export { fgMap, bgMap };
46
+ //# sourceMappingURL=paint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paint.js","sourceRoot":"","sources":["../../src/paint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EACnC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAC3D,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAA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AG,IAAI,GAAG,KAAK,EAAE,CAAC;AACpC,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { paint } from './paint.js';
2
+ export const style = {
3
+ error(msg) {
4
+ return paint(`✖ ${msg}`, { color: 'red' });
5
+ },
6
+ success(msg) {
7
+ return paint(`✔ ${msg}`, { color: 'green' });
8
+ },
9
+ warn(msg) {
10
+ return paint(`⚠ ${msg}`, { color: 'yellow' });
11
+ },
12
+ info(msg) {
13
+ return paint(`ℹ ${msg}`, { color: 'blue' });
14
+ },
15
+ muted(msg) {
16
+ return paint(msg, { color: 'gray', dim: true });
17
+ },
18
+ bold(msg) {
19
+ return paint(msg, { color: 'white', bold: true });
20
+ },
21
+ highlight(msg) {
22
+ return paint(msg, { color: 'cyan' });
23
+ },
24
+ divider(color = 'gray') {
25
+ return paint('─'.repeat(40), { color });
26
+ },
27
+ table(data, color = 'cyan') {
28
+ const keys = Object.keys(data);
29
+ if (keys.length === 0)
30
+ return '';
31
+ const keyWidth = Math.max(...keys.map((k) => k.length));
32
+ return keys
33
+ .map((key) => {
34
+ const paddedKey = key.padEnd(keyWidth);
35
+ return `${paint(paddedKey, { color })} ${data[key]}`;
36
+ })
37
+ .join('\n');
38
+ },
39
+ timestamp(msg, color = 'gray') {
40
+ const now = new Date();
41
+ const hh = String(now.getHours()).padStart(2, '0');
42
+ const mm = String(now.getMinutes()).padStart(2, '0');
43
+ const ss = String(now.getSeconds()).padStart(2, '0');
44
+ const prefix = paint(`[${hh}:${mm}:${ss}]`, { color });
45
+ return `${prefix} ${msg}`;
46
+ },
47
+ };
48
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,MAAM,YAAY,CAAC;AAE/C,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,KAAK,CAAC,GAAW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AG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QACxD,OAAO,IAAI;aACR,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACX,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACvC,OAAO,GAAG,KAAK,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACxD,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED,SAAS,CAAC,GAAW,EAAE,QAAe,MAAM;QAC1C,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACnD,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACrD,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACvD,OAAO,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC;IAC5B,CAAC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Color } from './paint.js';
2
+ export declare function badge(text: string, color?: Color): string;
3
+ //# sourceMappingURL=badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/badge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AAI/C,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,KAAe,GAAG,MAAM,CAIlE"}
@@ -0,0 +1,3 @@
1
+ import { type Color } from './paint.js';
2
+ export declare function box(text: string, color?: Color): string;
3
+ //# sourceMappingURL=box.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../src/box.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AAI/C,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,KAAe,GAAG,MAAM,CAuBhE"}
@@ -0,0 +1,24 @@
1
+ export declare const RESET = "\u001B[0m";
2
+ export declare const BOLD = "\u001B[1m";
3
+ export declare const DIM = "\u001B[2m";
4
+ export declare const ITALIC = "\u001B[3m";
5
+ export declare const UNDERLINE = "\u001B[4m";
6
+ export declare const BLACK = "\u001B[30m";
7
+ export declare const RED = "\u001B[31m";
8
+ export declare const GREEN = "\u001B[32m";
9
+ export declare const YELLOW = "\u001B[33m";
10
+ export declare const BLUE = "\u001B[34m";
11
+ export declare const MAGENTA = "\u001B[35m";
12
+ export declare const CYAN = "\u001B[36m";
13
+ export declare const WHITE = "\u001B[37m";
14
+ export declare const GRAY = "\u001B[90m";
15
+ export declare const BG_BLACK = "\u001B[40m";
16
+ export declare const BG_RED = "\u001B[41m";
17
+ export declare const BG_GREEN = "\u001B[42m";
18
+ export declare const BG_YELLOW = "\u001B[43m";
19
+ export declare const BG_BLUE = "\u001B[44m";
20
+ export declare const BG_MAGENTA = "\u001B[45m";
21
+ export declare const BG_CYAN = "\u001B[46m";
22
+ export declare const BG_WHITE = "\u001B[47m";
23
+ export declare const BG_GRAY = "\u001B[100m";
24
+ //# sourceMappingURL=codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../src/codes.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,KAAK,cAAY,CAAC;AAG/B,eAAO,MAAM,IAAI,cAAY,CAAC;AAC9B,eAAO,MAAM,GAAG,cAAY,CAAC;AAC7B,eAAO,MAAM,MAAM,cAAY,CAAC;AAChC,eAAO,MAAM,SAAS,cAAY,CAAC;AAGnC,eAAO,MAAM,KAAK,eAAa,CAAC;AAChC,eAAO,MAAM,GAAG,eAAa,CAAC;AAC9B,eAAO,MAAM,KAAK,eAAa,CAAC;AAChC,eAAO,MAAM,MAAM,eAAa,CAAC;AACjC,eAAO,MAAM,IAAI,eAAa,CAAC;AAC/B,eAAO,MAAM,OAAO,eAAa,CAAC;AAClC,eAAO,MAAM,IAAI,eAAa,CAAC;AAC/B,eAAO,MAAM,KAAK,eAAa,CAAC;AAChC,eAAO,MAAM,IAAI,eAAa,CAAC;AAG/B,eAAO,MAAM,QAAQ,eAAa,CAAC;AACnC,eAAO,MAAM,MAAM,eAAa,CAAC;AACjC,eAAO,MAAM,QAAQ,eAAa,CAAC;AACnC,eAAO,MAAM,SAAS,eAAa,CAAC;AACpC,eAAO,MAAM,OAAO,eAAa,CAAC;AAClC,eAAO,MAAM,UAAU,eAAa,CAAC;AACrC,eAAO,MAAM,OAAO,eAAa,CAAC;AAClC,eAAO,MAAM,QAAQ,eAAa,CAAC;AACnC,eAAO,MAAM,OAAO,gBAAc,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns true if ANSI color codes should be emitted.
3
+ * Colors are disabled when any of the following are true:
4
+ * - NO_COLOR env var is set (https://no-color.org)
5
+ * - CI env var is set (raw escape codes look broken in most CI logs)
6
+ * - process.stdout.isTTY is false/undefined (output is being piped)
7
+ */
8
+ export declare function isColorEnabled(): boolean;
9
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAKxC"}
@@ -0,0 +1,8 @@
1
+ export { paint } from './paint.js';
2
+ export type { PaintOptions, Color } from './paint.js';
3
+ export { style } from './style.js';
4
+ export { badge } from './badge.js';
5
+ export { box } from './box.js';
6
+ export { isColorEnabled } from './env.js';
7
+ export * from './codes.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,cAAc,YAAY,CAAC"}
@@ -0,0 +1,14 @@
1
+ export type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray';
2
+ export interface PaintOptions {
3
+ color?: Color;
4
+ bg?: Color;
5
+ bold?: boolean;
6
+ dim?: boolean;
7
+ italic?: boolean;
8
+ underline?: boolean;
9
+ }
10
+ declare const fgMap: Record<Color, string>;
11
+ declare const bgMap: Record<Color, string>;
12
+ export declare function paint(text: string, options?: PaintOptions): string;
13
+ export { fgMap, bgMap };
14
+ //# sourceMappingURL=paint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paint.d.ts","sourceRoot":"","sources":["../../src/paint.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAE1G,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,EAAE,CAAC,EAAE,KAAK,CAAC;IACX,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,QAAA,MAAM,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAUhC,CAAC;AAEF,QAAA,MAAM,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAUhC,CAAC;AAEF,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,MAAM,CAWtE;AAED,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type Color } from './paint.js';
2
+ export declare const style: {
3
+ error(msg: string): string;
4
+ success(msg: string): string;
5
+ warn(msg: string): string;
6
+ info(msg: string): string;
7
+ muted(msg: string): string;
8
+ bold(msg: string): string;
9
+ highlight(msg: string): string;
10
+ divider(color?: Color): string;
11
+ table(data: Record<string, string>, color?: Color): string;
12
+ timestamp(msg: string, color?: Color): string;
13
+ };
14
+ //# sourceMappingURL=style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAE/C,eAAO,MAAM,KAAK;eACL,MAAM,GAAG,MAAM;iBAGb,MAAM,GAAG,MAAM;cAGlB,MAAM,GAAG,MAAM;cAGf,MAAM,GAAG,MAAM;eAGd,MAAM,GAAG,MAAM;cAGhB,MAAM,GAAG,MAAM;mBAGV,MAAM,GAAG,MAAM;oBAIf,KAAK,GAAY,MAAM;gBAI1B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAAS,KAAK,GAAY,MAAM;mBAYnD,MAAM,UAAS,KAAK,GAAY,MAAM;CAQtD,CAAC"}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "termpainter",
3
+ "version": "1.0.0",
4
+ "description": "Zero-dependency terminal styling toolkit for Node.js and Bun",
5
+ "type": "module",
6
+ "main": "./dist/cjs/index.js",
7
+ "module": "./dist/esm/index.js",
8
+ "types": "./dist/types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/types/index.d.ts",
13
+ "default": "./dist/esm/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/types/index.d.cts",
17
+ "default": "./dist/cjs/index.cjs"
18
+ }
19
+ }
20
+ },
21
+ "files": [
22
+ "dist/",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "scripts": {
27
+ "build": "node build.mjs",
28
+ "prepublishOnly": "npm run build"
29
+ },
30
+ "engines": {
31
+ "node": ">=18"
32
+ },
33
+ "keywords": [
34
+ "ansi",
35
+ "terminal",
36
+ "colors",
37
+ "cli",
38
+ "styling",
39
+ "chalk-alternative",
40
+ "paint",
41
+ "badge",
42
+ "box"
43
+ ],
44
+ "author": "Abdullah Hashmi",
45
+ "license": "MIT",
46
+ "homepage": "",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": ""
50
+ },
51
+ "bugs": {
52
+ "url": ""
53
+ },
54
+ "devDependencies": {
55
+ "@types/node": "^25.5.0",
56
+ "typescript": "^6.0.2"
57
+ }
58
+ }