termark 2.1.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
@@ -1,313 +1,192 @@
1
- # ![Termark](https://static.q-file.com/projects/termark/termark.svg)
2
-
3
- Termark is a basic library to format console output to the standard non-browser terminal.
4
-
5
- ## Features & Highlights
6
-
7
- - Zero dependencies
8
- - [ESM & CJS compatible](#esm--cjs-compatibility)
9
- - [NO_COLOR](https://no-color.org/)-friendly
10
- - [Default and named imports](#default--named-imports)
11
- - [Basic ANSI styling](#basic-ansi-styling) (`dim`, `bold`, `italic`, …)
12
- - [4-bit](#4-bit-colours) ($2^4 = 16$) colours (`red`, `cyan`, `blueBright`, …)
13
- - [8-bit](#8-bit-colours) ($2^8 = 256$) colours (`ansi256()`)
14
- - [24-bit](#24-bit-colours) ($2^{24} = 16777216$; `truecolor`) colours (`rgb()`)
15
- - [Gradients](#gradients) (`gradient()`)
16
- - Built-in [terminal logging methods](#built-in-terminal-logging-methods) (`success()`, `info()`, `warn()`, `error()`)
17
- - [Template strings](#template-strings) & [nested styles](#nested-styles) (``` green`Success: File ${cyan`plans.txt`} created successfully!` ```)
18
- - [Colour-detection utilities](#colour-detection-utilities) (`areColorsEnabled`, `is8bitEnabled`, `is24bitEnabled`)
19
- - [Usage as an object or as a class](#class-v-object)
20
- - [Custom themes & loggers](#custom-themes-and-loggers)
21
-
22
- ## Installation
23
-
24
- ```bash
25
- npm install termark
26
- ```
27
-
28
- ## ESM & CJS compatibility
29
-
30
- Termark is compatible with both ECMAScript modules (`import`/`export` syntax), and CommonJS:
31
-
32
- ```js
33
- // CJS:
34
- const termark = require('termark');
35
-
36
- // ESM:
37
- import termark from 'termark';
38
- ```
39
-
40
- ## Default & named imports
41
-
42
- Termark offers both a default import that has access to all properties and methods, or you can import each one individually:
43
-
44
- ```ts
45
- // Default import:
46
- import termark from 'termark';
47
-
48
- termark.info('This is the default import, where all properties and methods are accessible.');
49
-
50
- // Named imports:
51
- import { success, inverse } from 'termark';
52
-
53
- success(
54
- inverse('This text with a green background is achieved with named imports!')
55
- )
56
- ```
57
-
58
- ## Usage
59
-
60
- Here's a quick reference for every feature Termark provides:
61
-
62
- ```ts
63
- import termark from 'termark';
64
-
65
- console.log(
66
- termark.red('This is red text.'),
67
- termark.bgGreen('This text has a green background.'),
68
- termark.cyan`There's support for template strings as well`,
69
- termark.ansi256('text', 33)('This single function handles text and background colour!'),
70
- termark.rgb('background', 42, 122, 255)('This is some dark blue text'),
71
- termark.gradient('text', [[53, 72, 172], [200, 230, 121]])('Gradients are also possible.'),
72
- termark.areColorsEnabled,
73
- termark.is8bitEnabled,
74
- termark.is24bitEnabled
75
- );
76
- ```
77
-
78
- ### Basic ANSI styling
79
-
80
- ```ts
81
- import termark from 'termark';
82
-
83
- termark.reset('...');
84
- termark.bold('...');
85
- termark.dim('...');
86
- termark.italic('...');
87
- termark.underline('...');
88
- termark.blink('...');
89
- termark.inverse('...');
90
- termark.overline('...');
91
- termark.hidden('...');
92
- termark.strike('...');
93
- ```
94
-
95
- ### 4-bit colours
96
-
97
- ```ts
98
- import termark from 'termark';
99
-
100
- termark.black('...');
101
- termark.red('...');
102
- termark.green('...');
103
- termark.yellow('...');
104
- termark.blue('...');
105
- termark.magenta('...');
106
- termark.white('...');
107
-
108
- termark.blackBright('...');
109
- termark.redBright('...');
110
- termark.greenBright('...');
111
- termark.yellowBright('...');
112
- termark.blueBright('...');
113
- termark.magentaBright('...');
114
- termark.whiteBright('...');
115
-
116
- termark.bgBlack('...');
117
- termark.bgRed('...');
118
- termark.bgGreen('...');
119
- termark.bgYellow('...');
120
- termark.bgBlue('...');
121
- termark.bgMagenta('...');
122
- termark.bgWhite('...');
123
-
124
- termark.bgBlackBright('...');
125
- termark.bgRedBright('...');
126
- termark.bgGreenBright('...');
127
- termark.bgYellowBright('...');
128
- termark.bgBlueBright('...');
129
- termark.bgMagentaBright('...');
130
- termark.bgWhiteBright('...');
131
- ```
132
-
133
- ### 8-bit colours
134
-
135
- ```ts
136
- import termark from 'termark';
137
-
138
- termark.ansi256('text', 33)('...');
139
- termark.ansi256('background', 200)('...');
140
- ```
141
-
142
- ### 24-bit colours
143
-
144
- ```ts
145
- import termark from 'termark';
146
-
147
- // You can specify your RGB values as an array:
148
- termark.rgb('text', [182, 22, 234])('...');
149
- termark.rgb('background', [200, 0, 184])('...');
150
-
151
- // ...or as a simple list of three values:
152
- termark.rgb('text', 182, 22, 234)('...');
153
- termark.rgb('background', 200, 0, 184)('...');
154
-
155
-
156
- // This method is compatible with `color-convert`:
157
- import convert from 'color-convert';
158
-
159
- termark.rgb('text', convert.hex.rgb('008330'))('...');
160
- ```
161
-
162
- ### Gradients
163
-
164
- **Please note that gradients do not support nested styling.**
165
-
166
- ```ts
167
- import termark from 'termark';
168
-
169
- termark.gradient('text', [[200, 123, 0], [0, 255, 255], [177, 209, 10]])('...');
170
- termark.gradient('background', [[123, 75, 204], [255, 255, 255], [0, 44, 55]])('...');
171
- ```
172
-
173
- ### Built-in terminal logging methods
174
-
175
- ```ts
176
- import termark from 'termark';
177
-
178
- termark.success('...'); // Logs some message in green as an info message.
179
- termark.info('...'); // Logs some message in blue as an info message.
180
- termark.warning('...'); // Logs some message in yellow as a warning.
181
- termark.error('...'); // Logs some message in red as an error.
182
-
183
- // These also support prefixes for branding purposes:
184
-
185
- const brandPrefix = termark.blue('Example') + termark.blackBright(' - ');
186
-
187
- termark.error('File not found', brandPrefix);
188
- ```
189
-
190
- ### Template strings
191
-
192
- ```ts
193
- import termark from 'termark';
194
-
195
- // Instead of using this:
196
- termark.blue('...');
197
-
198
- // ...you can use this:
199
- termark.blue`...`;
200
- ```
201
-
202
- ### Nested styles
203
-
204
- ```ts
205
- import termark from 'termark';
206
-
207
- termark.blue(
208
- 'This is some blue text ' +
209
- termark.yellow('That becomes yellow,') +
210
- ' that becomes blue again.'
211
- );
212
- ```
213
-
214
- ### Colour-detection utilities
215
-
216
- ```ts
217
- import termark from 'termark';
218
-
219
- termark.areColorsEnabled; // Check whether terminal colours are enabled.
220
- termark.is8bitEnabled; // Check whether 8-bit (256) colours are enabled.
221
- termark.is24bitEnabled; // Check whether 24-bit (truecolor) colours are enabled.
222
- ```
223
-
224
- ### Class v. Object
225
-
226
- You can use Termark by importing the object, or you can import the class:
227
-
228
- ```ts
229
- import { Termark } from 'termark';
230
-
231
- const termark = new Termark(); // This is the same as importing the `termark` object.
232
- termark.success('Termark is working!');
233
-
234
- // Alternatively, you could do this:
235
- Termark.init.success('This work, too!');
236
- ```
237
-
238
- `Termark.init` enables using the `Termark` class as the default `termark` object.
239
-
240
- ### Custom themes and loggers
241
-
242
- You can create custom themes (a collection of multiple styles) and loggers:
243
-
244
- ```ts
245
- import termark, { Termark } from 'termark';
246
-
247
- const myTheme = Termark.createTheme(
248
- termark.blue, // <- Notice that we specify a built-in function *without calling it*!
249
- termark.bold // Same goes for this one.
250
- );
251
-
252
- console.log(
253
- myTheme('This text is bold and blue!')
254
- );
255
-
256
- // ------
257
-
258
- // All properties but `default` are completely optional.
259
- // If omitted, default ones are used
260
- const myLogger = Termark.createLogger({
261
- default: [
262
- termark.cyan,
263
- termark.italic
264
- ],
265
- success: {
266
- prefix: false, // Disable built-in prefix
267
- styles: [
268
- termark.greenBright,
269
- termark.bold
270
- ]
271
- },
272
- info: {
273
- prefix: 'Info' // Custom prefix to override the default
274
- // No custom styles--use default ones.
275
- },
276
- // leave `warn` as-is
277
- error: {
278
- // Use default prefix; omitting or setting to an empty string have the same result.
279
- styles: [
280
- termark.bgRedBright,
281
- termark.dim
282
- ]
283
- },
284
- });
285
-
286
- myLogger.log('...'); // Uses the `default` property's options.
287
- myLogger.success('...'); // Omitted prefix, uses custom styles.
288
- myLogger.info('...'); // Uses custom prefix, default styles.
289
- myLogger.warn('...'); // Left as-is.
290
- myLogger.error('...'); // Uses default prefix, with custom styles.
291
- ```
292
-
293
- ## Licence
294
-
295
- Termark's code is licenced under the [Apache licence version 2](https://www.apache.org/licenses/LICENSE-2.0).
296
- The full licence text is present in these source files.
297
- In addition, this snippet of text is present at the top of all files:
298
-
299
- ```txt
300
- Copyright 2025 Q
301
-
302
- Licensed under the Apache License, Version 2.0 (the "License");
303
- you may not use this file except in compliance with the License.
304
- You may obtain a copy of the License at
305
-
306
- http://www.apache.org/licenses/LICENSE-2.0
307
-
308
- Unless required by applicable law or agreed to in writing, software
309
- distributed under the License is distributed on an "AS IS" BASIS,
310
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
311
- See the License for the specific language governing permissions and
312
- limitations under the License.
313
- ```
1
+ <div align="center">
2
+ <img alt="Termark" src="logo.webp" title="Termark logo" />
3
+ </div>
4
+
5
+ Termark is a basic library to format console output to the standard non-browser terminal.
6
+
7
+ <!-- TOC -->
8
+
9
+ - [Features](#features)
10
+ - [Usage](#usage)
11
+ - [Installation](#installation)
12
+ - [ESM & CJS compatibility](#esm--cjs-compatibility)
13
+ - [Basic usage](#basic-usage)
14
+ - [Licence](#licence)
15
+ <!-- TOC -->
16
+
17
+ ## Features
18
+
19
+ - **Familiar syntax** (`fmt.bold.brightRed.bgBlue("...")`)
20
+ - **ESM & CJS compatibility**
21
+ - [**NO_COLOR**](https://no-color.org/)-friendly
22
+ - [**FORCE_COLOR**](https://force-color.org/)-friendly
23
+ - **`truecolor` support** including gradients
24
+ - **Automatic colour-support detection** with **step-wise fallback** (truecolor → 8-bit → 4-bit → plain text)
25
+ - **Extensible** via `extend`; includes built-in support for `css-color-names` via `fromColObject`
26
+ - **Runtime-agnostic** (currently supported: Node, Bun, Deno)
27
+
28
+ ## Usage
29
+
30
+ ### Installation
31
+
32
+ Termark can be installed via any package manager that can interact with the NPM registry:
33
+
34
+ ```bash
35
+ # NPM
36
+ npm i termark
37
+
38
+ # PNPM
39
+ pnpm add termark
40
+
41
+ # Deno
42
+ deno add npm:termark
43
+
44
+ # Bun
45
+ bun add termark
46
+ ```
47
+
48
+ ### ESM & CJS compatibility
49
+
50
+ Termark is compatible with ECMAScript modules (`import`/`export` syntax) and CommonJS:
51
+
52
+ ```js
53
+ // CJS:
54
+ const { fmt } = require("termark");
55
+
56
+ // ESM:
57
+ import { fmt } from "termark";
58
+ ```
59
+
60
+ ### Basic usage
61
+
62
+ All exports of Termark are named exports, with the primary tool being `fmt` ("format"):
63
+
64
+ ```ts
65
+ import { fmt } from "termark";
66
+
67
+ // Basic chaining syntax
68
+ console.log(fmt.blue.bold("Text"));
69
+
70
+ // Nesting style
71
+ console.log(fmt.bold.red(`Error: This ${fmt.brightCyan("file")} is corrupted!`));
72
+ ```
73
+
74
+ ### Advanced colouring
75
+
76
+ Termark features methods like `hex` and `rgb` as well as the powerful `gradient` for advanced, versatile colouring.
77
+ All of these methods feature `bg*` variants, e.g. `bgHex`, which apply colour to the background of the text rather
78
+ than the text itself.
79
+
80
+ ```ts
81
+ import { fmt } from "termark";
82
+
83
+ // Hex and RGB colour-mapping
84
+ console.log(fmt.hex("#80b3ff").text("Light blue text"));
85
+ console.log(fmt.rgb([0, 255, 128]).text("Light green text"));
86
+
87
+ // Gradients (supports hex string/RGB tuple arrays)
88
+ const sunset = ["#ff5e62", "#f96"];
89
+ console.log(fmt.gradient(sunset).text("Beautiful terminal gradient"));
90
+
91
+ // Background variants (`bgHex`, `bgRgb`, `bgGradient`)
92
+ console.log(fmt.bgHex("#222").white("..."));
93
+ ```
94
+
95
+ Termark also features the ability to use singular 8-bit colour codes to style outputs with `fg` and `bg`.
96
+
97
+ ```ts
98
+ import { fmt } from "termark";
99
+
100
+ console.log(fmt.fg(57).text("..."));
101
+ ```
102
+
103
+ **Note:** The `.text()` method is designed for `hex`, `rgb`, `gradient` and `fg` (and their `bg*` counterparts) when
104
+ they are the last in the chain or when no other styling is needed. However, technically _all_ styling chains can be
105
+ terminated by `.text()`, e.g. `fmt.bold.red.text("...")`. `.text()` exists to eliminate the need to write
106
+ `hex("#338cd1")("Coloured text")`, which is still an option, but it's not elegant.
107
+
108
+ ### Layout utilities
109
+
110
+ #### `box`
111
+
112
+ Termark features a powerful `box` method which lets you encase your text in a, well, box.
113
+
114
+ ```ts
115
+ import { fmt, box } from "termark";
116
+
117
+ const myBox = box(fmt.bold.brightGreen("Deployment successful!"), {
118
+ kind: "rounded",
119
+ padding: 2, // Vertical padding only increases every four units by default.
120
+ margin: 3, // Vertical margin only increases every four units by default.
121
+ style: fmt.hex("#ffa500"), // Orange border
122
+ });
123
+
124
+ console.log(myBox);
125
+ ```
126
+
127
+ **Note:** `margin` and `padding` also accept objects to customize top, bottom, left, and right margin/padding.
128
+
129
+ ### Extensibility
130
+
131
+ **Note:** All extensions of Termark must be called as the last one in a given chain, and a string must be passed.
132
+
133
+ #### via `extend`
134
+
135
+ With the `extend` function, any kind of method can be created as an extension of Termark, such as shortcuts to styles.
136
+
137
+ ```ts
138
+ import { extend } from "termark";
139
+
140
+ const myLib = extend((base) => ({
141
+ // Formatting extensions
142
+ shout: (str) => base.red.bold(str.toUpperCase()),
143
+ // Colouring extensions
144
+ orange: (str) => base.hex("#ffa500").text(str),
145
+ }));
146
+
147
+ console.log(myLib.shout("This text is bold in red and all-caps"));
148
+ ```
149
+
150
+ Transformations apply to nested styles, too; for `shout` above, all nested text will be upper-case.
151
+
152
+ #### via `fromColObject`
153
+
154
+ The `fromColObject` function enables mapping mass colour dictionaries into styling methods. Excellent for packages
155
+ like [`css-color-names`](https://github.com/bahamas10/css-color-names) or
156
+ [`color-names`](https://github.com/meodai/color-names) (the latter with some additional work).
157
+
158
+ ```ts
159
+ import { fromColObject } from "termark";
160
+ import cssColours from "css-color-names";
161
+
162
+ const extendedWithCss = fromColObject(cssColours);
163
+ ```
164
+
165
+ By default, background styling methods aren't created. To do that, simply pass `true` for the second parameter.
166
+
167
+ ```ts
168
+ import { fromColObject } from "termark";
169
+ import cssColours from "css-color-names";
170
+
171
+ const withBg = fromColObject(cssColours, true);
172
+ ```
173
+
174
+ ### Hyperlinks
175
+
176
+ Hyperlinks are achieved by Termark with the help
177
+ of [OSC 8](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda). Currently, it is non-standard, and may not be supported in every terminal.
178
+
179
+ ```ts
180
+ import { fmt } from "termark";
181
+
182
+ const link = fmt.link("https://q-file.com");
183
+ const linkWithText = fmt.link("https://q-file.com", "Website");
184
+
185
+ const styled = fmt.hex("#a7f").link("https://q-file.com", "Website");
186
+ ```
187
+
188
+ `link` must be called as the last element in the chain.
189
+
190
+ ## Licence
191
+
192
+ Termark's code is licenced under the [Apache licence version 2](https://www.apache.org/licenses/LICENSE-2.0).
package/dist/index.cjs CHANGED
@@ -1 +1,5 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=()=>!process.env.NO_COLOR,r=()=>{const e=process.env.COLORTERM;return{is16bit:!!e&&(e.includes("ansi")&&!e.includes("256")),is256:!!e&&e.includes("ansi256"),isTrueColor:!!e&&(e.includes("truecolor")||e.includes("24bit"))}};function t(r,t,i){if("color"===i&&!e())return e=>e.toString();const o=`[${r}m`,s=`[${t}m`;return e=>{const r=e.toString().trim();return-1===r.indexOf(s)?`${o}${r}${s}`:`${o}${r.replaceAll(s,s+o)}${s}`}}function i(e,r,t){return[Math.round(e[0]+t*(r[0]-e[0])),Math.round(e[1]+t*(r[1]-e[1])),Math.round(e[2]+t*(r[2]-e[2]))]}function o(e,r,t){if("number"!=typeof e)throw new TypeError(`Parameter ${JSON.stringify(e)} must be a finite number, which it currently isn't!`);return Math.min(Math.max(e,r),t)}class s{constructor(){this.areColorsEnabled=e(),this.is8bitEnabled=r().is256,this.is24bitEnabled=r().isTrueColor,this.reset=t(0,0,"format"),this.bold=t(1,22,"format"),this.dim=t(2,22,"format"),this.italic=t(3,23,"format"),this.underline=t(4,24,"format"),this.blink=t(5,25,"format"),this.inverse=t(7,27,"format"),this.overline=t(53,55,"format"),this.hidden=t(8,28,"format"),this.strike=t(9,29,"format"),this.black=t(30,39,"color"),this.red=t(31,39,"color"),this.green=t(32,39,"color"),this.yellow=t(33,39,"color"),this.blue=t(34,39,"color"),this.magenta=t(35,39,"color"),this.cyan=t(36,39,"color"),this.white=t(37,39,"color"),this.blackBright=t(90,39,"color"),this.redBright=t(91,39,"color"),this.greenBright=t(92,39,"color"),this.yellowBright=t(93,39,"color"),this.blueBright=t(94,39,"color"),this.magentaBright=t(95,39,"color"),this.cyanBright=t(96,39,"color"),this.whiteBright=t(97,39,"color"),this.bgBlack=t(40,49,"color"),this.bgRed=t(41,49,"color"),this.bgGreen=t(42,49,"color"),this.bgYellow=t(43,49,"color"),this.bgBlue=t(44,49,"color"),this.bgMagenta=t(45,49,"color"),this.bgCyan=t(46,49,"color"),this.bgWhite=t(47,49,"color"),this.bgBlackBright=t(100,49,"color"),this.bgRedBright=t(101,49,"color"),this.bgGreenBright=t(102,49,"color"),this.bgYellowBright=t(103,49,"color"),this.bgBlueBright=t(104,49,"color"),this.bgMagentaBright=t(105,49,"color"),this.bgCyanBright=t(106,49,"color"),this.bgWhiteBright=t(107,49,"color")}static get init(){return new this.termarkInstance}ansi256(i,s){if(!r().is256||!e())return e=>e.toString();s=o(s,0,255);return t("text"===i?`38;5;${s}`:`48;5;${s}`,"text"===i?39:49,"color")}rgb(e,...i){if(!r().isTrueColor)return e=>e.toString();let s,n,l;Array.isArray(i[0])?(s=o(i[0][0],0,255),n=o(i[0][1],0,255),l=o(i[0][2],0,255)):(s=o(i[0],0,255),n=o(i[1],0,255),l=o(i[2],0,255));return t("text"===e?`38;2;${s};${n};${l}`:`48;2;${s};${n};${l}`,"text"===e?39:49,"color")}gradient(t,o){if(!e()||!r().isTrueColor)return e=>e.toString();const s="text"===t?"[38;2;":"[48;2;",n="text"===t?"":"";return e=>{const r=e.toString().trim(),t=o.length,l=Math.min(r.length/(t-1));let g="";for(let e=0;e<r.length;e++){const c=Math.min(Math.floor(e/l),t-2),a=e%l/l,h=i(o[c],o[c+1],a);g+=`${s}${h[0]};${h[1]};${h[2]}m${r[e]}${n}`}return g}}success(e,r=""){console.info(`${s.successPrefix} ${r}${s.init.green(e)}`)}info(e,r=""){console.info(`${s.infoPrefix} ${r}${s.init.blue(e)}`)}warn(e,r=""){console.warn(`${s.warnPrefix} ${r}${s.init.yellow(e)}`)}error(e,r=""){console.error(`${s.errorPrefix} ${r}${s.init.red(e)}`)}custom(e,r,i){return t(e,r,"asColor"===i?"color":"format")}static createTheme(...e){const r=[];return e.forEach(e=>r.push(e)),e=>{const t=e.toString();return r.reduce((e,r)=>r(e),t)}}static createLogger(e){var r,t,i,o,n,l,g,c;const a=void 0===(null===(r=e.success)||void 0===r?void 0:r.prefix)||""===e.success.prefix?s.successPrefix:!1===e.success.prefix?"":e.success.prefix,h=void 0===(null===(t=e.info)||void 0===t?void 0:t.prefix)||""===e.info.prefix?s.infoPrefix:!1===e.info.prefix?"":e.info.prefix,b=void 0===(null===(i=e.warn)||void 0===i?void 0:i.prefix)||""===e.warn.prefix?s.warnPrefix:!1===e.warn.prefix?"":e.warn.prefix,x=void 0===(null===(o=e.error)||void 0===o?void 0:o.prefix)||""===e.error.prefix?s.errorPrefix:!1===e.error.prefix?"":e.error.prefix,u=s.createTheme(...e.default),d=s.createTheme(...void 0!==(null===(n=e.success)||void 0===n?void 0:n.styles)&&0!==e.success.styles.length?e.success.styles:[s.init.green]),p=s.createTheme(...void 0!==(null===(l=e.info)||void 0===l?void 0:l.styles)&&0!==e.info.styles.length?e.info.styles:[s.init.blue]),f=s.createTheme(...void 0!==(null===(g=e.warn)||void 0===g?void 0:g.styles)&&0!==e.warn.styles.length?e.warn.styles:[s.init.yellow]),B=s.createTheme(...void 0!==(null===(c=e.error)||void 0===c?void 0:c.styles)&&0!==e.error.styles.length?e.error.styles:[s.init.red]);return{log(e,r=""){console.log(`${r}${u(e)}`)},success(e,r=""){console.info(`${a?a+" ":""}${r}${d(e)}`)},info(e,r=""){console.info(`${h?h+" ":""}${r}${p(e)}`)},warn(e,r=""){console.info(`${b?b+" ":""}${r}${f(e)}`)},error(e,r=""){console.info(`${x?x+" ":""}${r}${B(e)}`)}}}}s.termarkInstance=s,s.successPrefix=s.init.green(s.init.bold("[✓]")),s.infoPrefix=s.init.blue(s.init.bold("[i]")),s.warnPrefix=s.init.yellow(s.init.bold("[!]")),s.errorPrefix=s.init.red(s.init.bold("[X]"));const n=s.init,{areColorsEnabled:l,is8bitEnabled:g,is24bitEnabled:c,reset:a,bold:h,dim:b,italic:x,underline:u,blink:d,inverse:p,overline:f,hidden:B,strike:m,black:$,red:w,green:y,yellow:v,blue:k,magenta:C,cyan:M,white:T,blackBright:P,redBright:E,greenBright:R,yellowBright:O,blueBright:S,magentaBright:G,cyanBright:W,whiteBright:Y,bgBlack:L,bgRed:A,bgGreen:_,bgYellow:I,bgBlue:N,bgMagenta:j,bgCyan:J,bgWhite:X,bgBlackBright:q,bgRedBright:z,bgGreenBright:D,bgYellowBright:F,bgBlueBright:H,bgMagentaBright:K,bgCyanBright:Q,bgWhiteBright:U,ansi256:V,rgb:Z,gradient:ee,success:re,info:te,warn:ie,error:oe,custom:se}=n,{createTheme:ne,createLogger:le}=s;exports.Termark=s,exports.ansi256=V,exports.areColorsEnabled=l,exports.bgBlack=L,exports.bgBlackBright=q,exports.bgBlue=N,exports.bgBlueBright=H,exports.bgCyan=J,exports.bgCyanBright=Q,exports.bgGreen=_,exports.bgGreenBright=D,exports.bgMagenta=j,exports.bgMagentaBright=K,exports.bgRed=A,exports.bgRedBright=z,exports.bgWhite=X,exports.bgWhiteBright=U,exports.bgYellow=I,exports.bgYellowBright=F,exports.black=$,exports.blackBright=P,exports.blink=d,exports.blue=k,exports.blueBright=S,exports.bold=h,exports.createLogger=le,exports.createTheme=ne,exports.custom=se,exports.cyan=M,exports.cyanBright=W,exports.default=n,exports.dim=b,exports.error=oe,exports.gradient=ee,exports.green=y,exports.greenBright=R,exports.hidden=B,exports.info=te,exports.inverse=p,exports.is24bitEnabled=c,exports.is8bitEnabled=g,exports.italic=x,exports.magenta=C,exports.magentaBright=G,exports.overline=f,exports.red=w,exports.redBright=E,exports.reset=a,exports.rgb=Z,exports.strike=m,exports.success=re,exports.underline=u,exports.warn=ie,exports.white=T,exports.whiteBright=Y,exports.yellow=v,exports.yellowBright=O;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e){if(typeof globalThis.process?.env==`object`)return globalThis.process.env[e];if(typeof globalThis.Deno?.env?.get==`function`)try{return globalThis.Deno.env.get(e)}catch{return}}function t(){if(globalThis.process?.stdout?.isTTY)return!0;if(typeof globalThis.Deno?.stdout?.isTerminal==`function`)try{return globalThis.Deno.stdout?.isTerminal()}catch{return!1}return!1}function n(){let t=e(`NO_COLOR`)||e(`NODE_DISABLE_COLORS`);return t!==void 0&&t!==``}function r(){if(n())return 0;let r=e(`FORCE_COLOR`);if(r!==void 0)return r===`0`?0:r===`1`?1:r===`2`?2:r===`3`?3:1;if(!t())return e(`CI`)&&(e(`GITHUB_ACTIONS`)||e(`GITLAB_CI`))?1:0;let i=e(`TERM`);if(i===`dumb`)return 0;let a=e(`COLORTERM`);return a===`truecolor`||a===`24bit`||e(`TERM_PROGRAM`)===`vscode`?3:i&&/-256(color)?$/i.test(i)||e(`TERM_PROGRAM`)===`Apple_Terminal`?2:(i&&/color|ansi|cygwin|linux/i.test(i),1)}const i=/^#?([a-f\d]{3}|[a-f\d]{6})$/i;function a(e,t,n){return Math.min(Math.max(e,t),n)}function o(e,t){if(e.length===1)return e[0];let n=t*(e.length-1),r=Math.min(Math.floor(n),e.length-2),i=n-r,a=e[r],o=e[r+1];return[Math.round(a[0]+(o[0]-a[0])*i),Math.round(a[1]+(o[1]-a[1])*i),Math.round(a[2]+(o[2]-a[2])*i)]}function s(e){return e.slice(0,1).toUpperCase()+e.slice(1)}function c(e){let t=i.exec(e);if(!t)return[255,255,255];let n=t[1].replace(/^#/,``),r=3^n.length?n:n.split(``).map(e=>e+e).join(``),a=parseInt(r,16);return[a>>16&255,a>>8&255,a&255]}function l([e,t,n]){return e^t||t^n?16+36*Math.round(e/51)+6*Math.round(t/51)+Math.round(n/51):e<8?16:e>248?231:Math.round((e-8)*24/247)+232}function u(e){if(e<8)return 30+e;if(e<16)return 82+e;let t,n,r;if(e<232){let i=e-16,a=i%36;t=(i/36|0)/5,n=(a/6|0)/5,r=a%6/5}else t=n=r=((e-232)*10+8)/255;let i=Math.max(t,n,r)*2,a=Math.round(t),o=Math.round(n)<<1,s=Math.round(r)<<2,c=2^i?0:60;return 30+(s|o|a)+c}function d(e){return`\x1b[${e}m`}function f(e,t,n){return e.indexOf(n)===-1?`${t}${e}${n}`:`${t}${e.replaceAll(n,n+t)}${n}`}const p={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],blink:[5,25],inverse:[7,27],overline:[53,55],hidden:[8,28],strike:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],brightBlack:[90,39],grey:[90,39],gray:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBrightBlack:[100,49],bgGrey:[100,49],bgGray:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49]};function m(e,t,n){let r=Array.from(e),i=r.length,a=t?.map(e=>typeof e==`string`?c(e):e),s=n?.map(e=>typeof e==`string`?c(e):e);return r.map((e,t)=>{let n=i>1?t/(i-1):0,r=``,c=``;if(a){let[e,t,i]=o(a,n);r+=`\x1b[38;2;${e};${t};${i}m`,c=`\x1B[39m`+c}if(s){let[e,t,i]=o(s,n);r+=`\x1b[48;2;${e};${t};${i}m`,c=`\x1B[49m`+c}return r+e+c}).join(``)}function h(e){return e.type===`fg`?_(e.code,`fg`):e.type===`bg`?_(e.code,`bg`):e.type===`hex`?y(e.hex,`fg`):e.type===`bgHex`?y(e.hex,`bg`):e.type===`rgb`?v([e.r,e.g,e.b],`fg`):e.type===`bgRgb`?v([e.r,e.g,e.b],`bg`):[``,``]}function g(e,t){let n=t.filter(e=>typeof e!=`string`&&(e.type===`gradient`||e.type===`bgGradient`)),r=n.filter(e=>e.type===`gradient`).at(-1),i=n.filter(e=>e.type===`bgGradient`).at(-1);return t.reduce((t,n)=>{let a=r||i?m(e,r?.colours,i?.colours):t;if(typeof n==`string`)return f(a,d(p[n][0]),d(p[n][1]));{let[e,t]=h(n);return f(a,e,t)}},e)}function _(e,t){if(n()||r()===0)return[``,``];let i=a(e,0,255),o=d(t===`fg`?39:49);if(r()>=2)return[d(t===`fg`?`38;5;${i}`:`48;5;${i}`),o];{let e=u(i);return[d(t===`fg`?e:e+10),o]}}function v(e,t){if(n()||r()===0)return[``,``];let i=e.map(e=>a(e,0,255)),o=d(t===`fg`?39:49);if(r()===3){let e=i.join(`;`);return[d(t===`fg`?`38;2;${e}`:`48;2;${e}`),o]}if(r()===2){let e=l(i);return[d(t===`fg`?`38;5;${e}`:`48;5;${e}`),o]}{let n=u(l(e));return[d(t===`fg`?n:n+10),o]}}function y(e,t){return i.test(e)?v(c(e),t):[``,``]}function b(e,t){let n=`\x1B]8;;`;return`${n}${e}\\${t||e}${n}\\`}function x(e,t){return new Proxy(t=>g(t,e),{get(n,r){return r in p?x([...e,r],t):r===`fg`?n=>x([...e,{type:`fg`,code:n}],t):r===`bg`?n=>x([...e,{type:`bg`,code:n}],t):r===`hex`?n=>x([...e,{type:`hex`,hex:n}],t):r===`bgHex`?n=>x([...e,{type:`bgHex`,hex:n}],t):r===`rgb`?([n,r,i])=>x([...e,{type:`rgb`,r:n,g:r,b:i}],t):r===`bgRgb`?([n,r,i])=>x([...e,{type:`bgRgb`,r:n,g:r,b:i}],t):r===`gradient`?n=>x([...e,{type:`gradient`,colours:n}],t):r===`bgGradient`?n=>x([...e,{type:`bgGradient`,colours:n}],t):r===`link`?(t,n)=>b(t,g(n??t,e)):r===`text`?t=>g(t,e):r in t?n=>g(t[r](n),e):n[r]}})}const S=x([],{});function C(){return r()!==0}function w(e){return r()>=e}function T(e){return r()<=e}function E(e){return t=>{let n=/(\u{001B}\[[0-9;]*[A-PRZ])|(.+?)/giu,r=``;for(let i of t.matchAll(n)){let t=i[0];r+=t.charCodeAt(0)===27?t:e(t)}return r}}const D=E(e=>e.toUpperCase()),O=E(e=>e.toLowerCase());function k(e){return e.replace(/\u{001B}\[[0-9;]*m/gu,``)}const A={sharp:{tl:`┌`,tr:`┐`,bl:`└`,br:`┘`,h:`─`,v:`│`},rounded:{tl:`╭`,tr:`╮`,bl:`╰`,br:`╯`,h:`─`,v:`│`},double:{tl:`╔`,tr:`╗`,bl:`╚`,br:`╝`,h:`═`,v:`║`},heavy:{tl:`┏`,tr:`┓`,bl:`┗`,br:`┛`,h:`━`,v:`┃`},dashed:{tl:`┌`,tr:`┐`,bl:`└`,br:`┘`,h:`⹀`,v:`╎`},dotted:{tl:`┌`,tr:`┐`,bl:`└`,br:`┘`,h:`╌`,v:`┊`},ascii:{tl:`+`,tr:`+`,bl:`+`,br:`+`,h:`-`,v:`|`}};function j(e,t={}){let{kind:n=`sharp`,style:r=e=>e,padding:i=1,margin:a=0}=t,o=typeof n==`string`?A[n]:n,s=typeof i==`number`?Math.floor(i/4):i.top??0,c=typeof i==`number`?Math.floor(i/4):i.bottom??0,l=typeof a==`number`?Math.floor(a/4):a.top??0,u=typeof a==`number`?Math.floor(a/4):a.bottom??0,d=e.split(`
2
+ `),f=d.map(e=>k(e).length),p=Math.max(...f),m=o.tl+o.h.repeat(p+(typeof i==`number`?i*2:(i.left??0)+(i.right??0)))+o.tr,h=o.bl+o.h.repeat(p+(typeof i==`number`?i*2:(i.left??0)+(i.right??0)))+o.br,g=` `.repeat(typeof a==`number`?a:a.left??0),_=` `.repeat(typeof a==`number`?a:a.right??0),v=`
3
+ `.repeat(l),y=`
4
+ `.repeat(u),b=g+r(m)+_,x=g+r(h)+_,S=g+r(o.v),C=r(o.v)+_;return`${v}${b}\n${d.map(e=>{let t=k(e),n=e+` `.repeat(p-t.length),r=S+` `.repeat((typeof i==`number`?i*2:(i.left??0)+(i.right??0))+t.length)+C,a=i===0?``:`${r}\n`.repeat(s),o=i===0?``:`\n${r}`.repeat(c),l=` `.repeat(typeof i==`number`?i:i.left??0),u=` `.repeat(typeof i==`number`?i:i.right??0);return`${a}${S}${l}${n}${u}${C}${o}`}).join(`
5
+ `)}\n${x}${y}`}function M(e){if(Array.isArray(e)){let t={};for(let n of e)Object.assign(t,n(S));return x([],t)}return x([],e(S))}function N(e,t){let n=Object.entries(e).map(([e,t])=>[e,e=>S.hex(t).text(e)]),r=t?Object.entries(e).map(([e,t])=>[`bg${s(e)}`,e=>S.bgHex(t).text(e)]):null;return M(()=>Object.fromEntries([...n,...r??[]]))}exports.ansiLowerCase=O,exports.ansiUpperCase=D,exports.areColoursSupported=C,exports.box=j,exports.extend=M,exports.fmt=S,exports.termark=S,exports.fromColObject=N,exports.getColorLevel=r,exports.getColourLevel=r,exports.hasNoColor=n,exports.hasNoColour=n,exports.link=b,exports.stripAnsi=k,exports.supports=w,exports.supportsAtMost=T,exports.transformPreserveAnsi=E;