@visulima/colorize 1.4.11 → 1.4.13
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/CHANGELOG.md +31 -0
- package/LICENSE.md +27 -0
- package/README.md +54 -54
- package/dist/gradient.cjs +3 -14
- package/dist/gradient.d.cts +1 -79
- package/dist/gradient.d.mts +34 -0
- package/dist/gradient.d.ts +1 -79
- package/dist/gradient.mjs +3 -0
- package/dist/index.browser.d.mts +65 -0
- package/dist/index.browser.d.ts +3 -66
- package/dist/index.browser.mjs +1 -0
- package/dist/index.server.cjs +2 -13
- package/dist/index.server.d.cts +3 -1
- package/dist/index.server.d.mts +65 -0
- package/dist/index.server.d.ts +3 -66
- package/dist/index.server.mjs +1 -0
- package/dist/packem_shared/Colorize-BG7_2JWK.mjs +2 -0
- package/dist/packem_shared/Colorize-gGSr400y.mjs +1 -0
- package/dist/packem_shared/GradientBuilder-Bn5OODm9.cjs +1 -0
- package/dist/packem_shared/GradientBuilder-CL8ERRQu.mjs +1 -0
- package/dist/packem_shared/colorize.server-BayBPE0C.mjs +2 -0
- package/dist/packem_shared/colorize.server-BdZzymFP.cjs +2 -0
- package/dist/packem_shared/convertHexToRgb-CSiKB7t1.mjs +1 -0
- package/dist/packem_shared/convertHexToRgb-DN4AQa3T.cjs +1 -0
- package/dist/packem_shared/rgbToAnsi256-D4IPvnol.cjs +1 -0
- package/dist/packem_shared/rgbToAnsi256-YETEPW8R.mjs +1 -0
- package/dist/packem_shared/types-CoLB2PX2.d.mjs +67 -0
- package/dist/packem_shared/types-CoLB2PX2.d.mts +67 -0
- package/dist/packem_shared/types-CuuGv4d0.d.cts +81 -0
- package/dist/packem_shared/types-CuuGv4d0.d.mjs +81 -0
- package/dist/packem_shared/types-CuuGv4d0.d.mts +81 -0
- package/dist/template.cjs +2 -15
- package/dist/template.d.cts +4 -64
- package/dist/template.d.mts +7 -0
- package/dist/template.d.ts +4 -64
- package/dist/template.mjs +2 -0
- package/dist/utils.cjs +1 -10
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.mts +9 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.mjs +1 -0
- package/package.json +41 -64
- package/dist/gradient.cjs.map +0 -1
- package/dist/gradient.js +0 -10
- package/dist/gradient.js.map +0 -1
- package/dist/index.browser.js +0 -5
- package/dist/index.browser.js.map +0 -1
- package/dist/index.server.cjs.map +0 -1
- package/dist/index.server.js +0 -8
- package/dist/index.server.js.map +0 -1
- package/dist/template.cjs.map +0 -1
- package/dist/template.js +0 -9
- package/dist/template.js.map +0 -1
- package/dist/utils.cjs.map +0 -1
- package/dist/utils.js +0 -5
- package/dist/utils.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
## @visulima/colorize [1.4.13](https://github.com/visulima/visulima/compare/@visulima/colorize@1.4.12...@visulima/colorize@1.4.13) (2024-12-12)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* allow node v23 ([8ca929a](https://github.com/visulima/visulima/commit/8ca929af311ce8036cbbfde68b6db05381b860a5))
|
|
6
|
+
* allowed node 23, updated dev dependencies ([f99d34e](https://github.com/visulima/visulima/commit/f99d34e01f6b13be8586a1b5d37dc8b8df0a5817))
|
|
7
|
+
* **colorize:** migrated from tsup to packem ([d9356e5](https://github.com/visulima/visulima/commit/d9356e57ddb8f915b412b3351b77e4b7471a30fe))
|
|
8
|
+
* updated packem to v1.9.2 ([47bdc2d](https://github.com/visulima/visulima/commit/47bdc2dfaeca4e7014dbe7772eae2fdf8c8b35bb))
|
|
9
|
+
|
|
10
|
+
### Styles
|
|
11
|
+
|
|
12
|
+
* cs fixes ([46d31e0](https://github.com/visulima/visulima/commit/46d31e082e1865262bf380859c14fabd28ff456d))
|
|
13
|
+
|
|
14
|
+
### Miscellaneous Chores
|
|
15
|
+
|
|
16
|
+
* **colorize:** fixed test on prod build ([be87894](https://github.com/visulima/visulima/commit/be87894d8ca2c33da6dda012c704a2a2413d4e54))
|
|
17
|
+
* updated dev dependencies ([a916944](https://github.com/visulima/visulima/commit/a916944b888bb34c34b0c54328b38d29e4399857))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Dependencies
|
|
21
|
+
|
|
22
|
+
* **@visulima/is-ansi-color-supported:** upgraded to 2.2.9
|
|
23
|
+
* **@visulima/path:** upgraded to 1.1.2
|
|
24
|
+
|
|
25
|
+
## @visulima/colorize [1.4.12](https://github.com/visulima/visulima/compare/@visulima/colorize@1.4.11...@visulima/colorize@1.4.12) (2024-10-05)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Dependencies
|
|
29
|
+
|
|
30
|
+
* **@visulima/path:** upgraded to 1.1.1
|
|
31
|
+
|
|
1
32
|
## @visulima/colorize [1.4.11](https://github.com/visulima/visulima/compare/@visulima/colorize@1.4.10...@visulima/colorize@1.4.11) (2024-10-05)
|
|
2
33
|
|
|
3
34
|
### Bug Fixes
|
package/LICENSE.md
CHANGED
|
@@ -39,3 +39,30 @@ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
39
39
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
40
40
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
41
41
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
42
|
+
|
|
43
|
+
<!-- DEPENDENCIES -->
|
|
44
|
+
|
|
45
|
+
# Licenses of bundled dependencies
|
|
46
|
+
The published @visulima/colorize artifact additionally contains code with the following licenses:
|
|
47
|
+
MIT
|
|
48
|
+
|
|
49
|
+
# Bundled dependencies:
|
|
50
|
+
## ansi-regex
|
|
51
|
+
License: MIT
|
|
52
|
+
By: Sindre Sorhus
|
|
53
|
+
Repository: chalk/ansi-regex
|
|
54
|
+
|
|
55
|
+
> MIT License
|
|
56
|
+
>
|
|
57
|
+
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
58
|
+
>
|
|
59
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
60
|
+
>
|
|
61
|
+
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
62
|
+
>
|
|
63
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
64
|
+
|
|
65
|
+
<!-- /DEPENDENCIES -->
|
|
66
|
+
|
|
67
|
+
<!-- TYPE_DEPENDENCIES -->
|
|
68
|
+
<!-- /TYPE_DEPENDENCIES -->
|
package/README.md
CHANGED
|
@@ -32,10 +32,10 @@ For instance, you can use `green` to make `` green`Hello World!` `` pop, `` red`
|
|
|
32
32
|
|
|
33
33
|
## Why Colorize?
|
|
34
34
|
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
35
|
+
- Supports both **ESM** and **CommonJS**
|
|
36
|
+
- **TypeScript** support out of the box
|
|
37
|
+
- Supports **Deno**, **Next.JS** runtimes and **Browser** (not only chrome) (currently multi nesting is not supported)
|
|
38
|
+
- [Standard API](#base-colors) compatible with **Chalk**, switch from **Chalk** to **Colorize** without changing your code
|
|
39
39
|
|
|
40
40
|
```diff
|
|
41
41
|
- import chalk from 'chalk';
|
|
@@ -46,29 +46,29 @@ red.bold('Error!'); // <- the same result with Colorize
|
|
|
46
46
|
red.bold`Error!`; // <- the same result with Colorize
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
49
|
+
- Default import
|
|
50
|
+
- `import colorize from '@visulima/colorize'` or `const colorize = require('@visulima/colorize')`
|
|
51
|
+
- [Named import](#named-import)
|
|
52
|
+
- `import { red } from '@visulima/colorize'` or `const { red } = require('@visulima/colorize')`
|
|
53
|
+
- [Chained syntax](#chained-syntax) `red.bold.underline('text')`
|
|
54
|
+
- [Template literals](#template-literals) `` red`text` ``
|
|
55
|
+
- String styling with [tagged template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates), see [template-literals](#tagged-template-literals)
|
|
56
|
+
- [Nested **template strings**](#nested-syntax) `` red`R ${green`G`} R` ``
|
|
57
|
+
- [Base ANSI styles](#base-colors) `dim` **`bold`** _`italic`_ <u>`underline`</u> <s>`strikethrough`</s>
|
|
58
|
+
- [Base ANSI 16 colors](#base-colors) `` red`Error!` `` `` redBright`Error!` `` `` bgRed`Error!` `` `` bgRedBright`Error!` ``
|
|
59
|
+
- [ANSI 256 colors](#256-colors) and [TrueColor](#truecolor) (**RGB**, **HEX**) `` rgb(224, 17, 95)`Ruby` ``, `` hex('#96C')`Amethyst` ``
|
|
60
|
+
- [TrueColor](#truecolor) (**RGB**, **HEX**) `` rgb(224, 17, 95)`Ruby` ``, `` hex('#96C')`Amethyst` ``
|
|
61
|
+
- [Fallback](#fallback) to supported [color space](#color-support): TrueColor → 256 colors → 16 colors → no colors
|
|
62
|
+
- [ANSI codes](#escape-codes) as `open` and `close` property for each style `` `Hello ${red.open}World${red.close}!` ``
|
|
63
|
+
- [Strip ANSI codes](#strip) method `colorize.strip()`
|
|
64
|
+
- [Correct style break](#new-line) at the `end of line` when used `\n` in string
|
|
65
|
+
- Supports the [environment variables](#cli-vars) `NO_COLOR` `FORCE_COLOR` and flags `--no-color` `--color`
|
|
66
|
+
- Expressive API
|
|
67
|
+
- Doesn't extend `String.prototype`
|
|
68
|
+
- Up to **x3 faster** than **chalk**, [see benchmarks](#benchmark)
|
|
69
|
+
- **Auto detects** color support
|
|
70
|
+
- Clean and focused
|
|
71
|
+
- [String Gradient´s](#gradient)
|
|
72
72
|
|
|
73
73
|
## Install
|
|
74
74
|
|
|
@@ -594,26 +594,26 @@ If you're on Windows, do yourself a favor and use [Windows Terminal](https://git
|
|
|
594
594
|
>
|
|
595
595
|
> **Naming colors**
|
|
596
596
|
>
|
|
597
|
-
> -
|
|
598
|
-
> -
|
|
597
|
+
> - standard: colors have [standard names](#base-colors-and-styles), e.g.: `red`, `redBright`, `bgRed`, `bgRedBright`
|
|
598
|
+
> - _non-standard_: colors have lib-specific names, e.g.: `brightRed`, `bgBrightRed`, `red_b`, `red_btt`
|
|
599
599
|
>
|
|
600
600
|
> **ANSI 256 colors**
|
|
601
601
|
>
|
|
602
602
|
> The method names:
|
|
603
603
|
>
|
|
604
|
-
> -
|
|
605
|
-
> -
|
|
606
|
-
> -
|
|
607
|
-
> -
|
|
608
|
-
> -
|
|
604
|
+
> - [`@visulima/colorize`][npm-url]: `ansi256(n)` `bgAnsi256(n)` `fg(n)` `bg(n)`
|
|
605
|
+
> - [`ansis`][ansis]: `ansi256(n)` `bgAnsi256(n)` `fg(n)` `bg(n)`
|
|
606
|
+
> - [`chalk`][chalk]: `ansi256(n)` `bgAnsi256(n)`
|
|
607
|
+
> - [`cli-color`][cli-color]: `xterm(n)`
|
|
608
|
+
> - [`colors-cli`][colors-cli]: `x<n>`
|
|
609
609
|
>
|
|
610
610
|
> **Truecolor**
|
|
611
611
|
>
|
|
612
612
|
> The method names:
|
|
613
613
|
>
|
|
614
|
-
> -
|
|
615
|
-
> -
|
|
616
|
-
> -
|
|
614
|
+
> - [`@visulima/colorize`][npm-url]: `hex()` `rgb()`
|
|
615
|
+
> - [`ansis`][ansis]: `hex()` `rgb()`
|
|
616
|
+
> - [`chalk`][chalk]: `hex()` `rgb()`
|
|
617
617
|
>
|
|
618
618
|
> **Chained syntax**\
|
|
619
619
|
> `lib.red.bold('text')`
|
|
@@ -670,8 +670,8 @@ console.log(gradient(["blue", "cyan", "blue"])("----------------"));
|
|
|
670
670
|
|
|
671
671
|
## Reference
|
|
672
672
|
|
|
673
|
-
-
|
|
674
|
-
-
|
|
673
|
+
- [The opaque named colors](https://drafts.csswg.org/css-color/#named-colors)
|
|
674
|
+
- [ANSI escape code](https://en.wikipedia.org/wiki/ANSI_escape_code)
|
|
675
675
|
|
|
676
676
|
The [ANSI Escape](https://en.wikipedia.org/wiki/ANSI_escape_code) sequences control code screen.
|
|
677
677
|
|
|
@@ -697,32 +697,32 @@ If you would like to help take a look at the [list of issues](https://github.com
|
|
|
697
697
|
|
|
698
698
|
## Credits
|
|
699
699
|
|
|
700
|
-
-
|
|
701
|
-
-
|
|
702
|
-
-
|
|
700
|
+
- [WebDiscus](https://github.com/webdiscus)
|
|
701
|
+
- [Daniel Bannert](https://github.com/prisis)
|
|
702
|
+
- [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
|
|
703
703
|
|
|
704
704
|
## About
|
|
705
705
|
|
|
706
706
|
### Related Projects
|
|
707
707
|
|
|
708
|
-
-
|
|
709
|
-
-
|
|
710
|
-
-
|
|
711
|
-
-
|
|
712
|
-
-
|
|
713
|
-
-
|
|
714
|
-
-
|
|
715
|
-
-
|
|
716
|
-
-
|
|
708
|
+
- [ansis][ansis] - The Node.js library for formatting text in terminal with ANSI colors & styles
|
|
709
|
+
- [ansi-colors][ansi-colors] - Easily add ANSI colors to your text and symbols in the terminal.
|
|
710
|
+
- [chalk][chalk] - Terminal string styling done right
|
|
711
|
+
- [cli-color][cli-color] - Colors and formatting for the console
|
|
712
|
+
- [colorette][colorette] - Easily set your terminal text color & styles
|
|
713
|
+
- [colors-cli][colors-cli] - Terminal string styling done right.
|
|
714
|
+
- [colors.js][colors.js] - get colors in your node.js console
|
|
715
|
+
- [kleur][kleur] - The fastest Node.js library for formatting terminal text with ANSI colors~!
|
|
716
|
+
- [picocolors][picocolors] - Tiny yet powerful colors for terminal
|
|
717
717
|
|
|
718
718
|
Template:
|
|
719
719
|
|
|
720
|
-
-
|
|
720
|
+
- [chalk-template][chalk-template] - Terminal string styling with tagged template literals
|
|
721
721
|
|
|
722
722
|
Gradient:
|
|
723
723
|
|
|
724
|
-
-
|
|
725
|
-
-
|
|
724
|
+
- [tinygradient](https://github.com/mistic100/tinygradient) - Easily generate color gradients with an unlimited number of color stops and steps.
|
|
725
|
+
- [gradient-string](https://github.com/bokub/gradient-string) - Beautiful color gradients in terminal output
|
|
726
726
|
|
|
727
727
|
## License
|
|
728
728
|
|
package/dist/gradient.cjs
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function w({onlyFirst:r=!1}={}){let o=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(o,r?void 0:"g")}var h=(r,e,o)=>e>r?e:r>o?o:r;var S=r=>{let[,e]=/([a-f\d]{3,6})/i.exec(r)??[],o=e?e.length:0;if(o===3)e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2];else if(o!==6)return [0,0,0];let n=Number.parseInt(e,16);return [n>>16&255,n>>8&255,n&255]};var v=(r,e,o)=>r===e&&e===o?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/51)+6*Math.round(e/51)+Math.round(o/51),R=r=>{let e,o,n;if(r<8)return 30+r;if(r<16)return 90+(r-8);if(r>=232)e=o=n=((r-232)*10+8)/255;else {r-=16;let i=r%36;e=Math.floor(r/36)/5,o=Math.floor(i/6)/5,n=i%6/5;}let t=Math.max(e,o,n)*2;if(t===0)return 30;let s=30+(Math.round(n)<<2|Math.round(o)<<1|Math.round(e));return t===2?s+60:s},T=(r,e,o)=>R(v(r,e,o));var c=39,m=49,L=10,G=isAnsiColorSupported.isStdoutColorSupported(),F={close:"",open:""},l=G>0?(r,e)=>({close:"\x1B["+e+"m",open:"\x1B["+r+"m"}):()=>F,E=r=>(e,o,n)=>r(v(Number(e),Number(o),Number(n))),Z=r=>e=>{let[o,n,t]=S(e);return r(o,n,t)},O=r=>l("38;5;"+r,c),A=r=>l("48;5;"+r,m),x=(r,e,o)=>l("38;2;"+r+";"+e+";"+o,c),B=(r,e,o)=>l("48;2;"+r+";"+e+";"+o,m);G===1?(O=r=>l(R(Number(r)),c),A=r=>l(R(Number(r))+L,m),x=(r,e,o)=>l(T(Number(r),Number(e),Number(o)),c),B=(r,e,o)=>l(T(Number(r),Number(e),Number(o))+L,m)):G===2&&(x=E(O),B=E(A));var M={bold:l(1,22),dim:l(2,22),hidden:l(8,28),inverse:l(7,27),italic:l(3,23),overline:l(53,55),reset:l(0,0),strike:l(9,29),strikethrough:l(9,29),underline:l(4,24),visible:F},z={bgBlack:l(40,m),bgBlackBright:l(100,m),bgBlue:l(44,m),bgBlueBright:l(104,m),bgCyan:l(46,m),bgCyanBright:l(106,m),bgGray:l(100,m),bgGreen:l(42,m),bgGreenBright:l(102,m),bgGrey:l(100,m),bgMagenta:l(45,m),bgMagentaBright:l(105,m),bgRed:l(41,m),bgRedBright:l(101,m),bgWhite:l(47,m),bgWhiteBright:l(107,m),bgYellow:l(43,m),bgYellowBright:l(103,m),black:l(30,c),blackBright:l(90,c),blue:l(34,c),blueBright:l(94,c),cyan:l(36,c),cyanBright:l(96,c),gray:l(90,c),green:l(32,c),greenBright:l(92,c),grey:l(90,c),magenta:l(35,c),magentaBright:l(95,c),red:l(31,c),redBright:l(91,c),white:l(37,c),whiteBright:l(97,c),yellow:l(33,c),yellowBright:l(93,c)},H={bg:r=>A(h(r,0,255)),bgHex:Z(B),bgRgb:(r,e,o)=>B(h(r,0,255),h(e,0,255),h(o,0,255)),fg:r=>O(h(r,0,255)),hex:Z(x),rgb:(r,e,o)=>x(h(r,0,255),h(e,0,255),h(o,0,255))};var W=(r,e,o)=>{if(e==="")return r;let n=r.indexOf(e);if(n<0)return r;let t=e.length,s=0,i="";for(;~n;)i+=r.slice(s,n)+o,s=n+t,n=r.indexOf(e,s);return i+r.slice(s)};var d={},N=null,U=(r,e,o)=>{if(!r)return "";let n=r.raw==null?r+"":String.raw(r,...e);if(n.includes("\x1B"))for(let t=o;t;t=t.props)n=W(n,t.close,t.open);return n.includes(`
|
|
6
|
-
`)&&(n=n.replace(/(\r*\n)/g,o.closeStack+"$1"+o.openStack)),o.openStack+n+o.closeStack},I=({props:r},{close:e,open:o})=>{let n=(r?.openStack??"")+o,t=e+(r?.closeStack??""),s=(i,...u)=>U(i,u,s.props);return Object.setPrototypeOf(s,N),s.props={close:e,closeStack:t,open:o,openStack:n,props:r},s.open=n,s.close=t,s},_=function(){let r=e=>e+"";r.strip=e=>e.replaceAll(w(),"");for(let e in z)d[e]={get(){let o=I(this,z[e]);return Object.defineProperty(this,e,{value:o}),o}};for(let e in M)d[e]={get(){let o=I(this,M[e]);return Object.defineProperty(this,e,{value:o}),o}};return N=Object.defineProperties({},d),Object.setPrototypeOf(r,N),r};for(let r in H)d[r]={get(){return (...e)=>I(this,H[r](...e))}};d.ansi256=d.fg;d.bgAnsi256=d.bg;var X=_;var D={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};var P=(r,e)=>{let o=r.length;if(e=Number.parseInt(e.toString(),10),Number.isNaN(e)||e<2)throw new Error("Invalid number of steps (< 2)");if(e<o)throw new Error("Number of steps cannot be inferior to number of stops");let n=[];for(let s=1;s<o;s++){let i=(e-1)*(r[s].position-r[s-1].position);n.push(Math.max(1,Math.round(i)));}let t=1;for(let s=o-1;s--;)t+=n[s];for(;t!==e;)if(t<e){let s=Math.min(...n);n[n.indexOf(s)]++,t++;}else {let s=Math.max(...n);n[n.indexOf(s)]--,t--;}return n};var Y=(r,e,o)=>{let n=0,t=0,s=0,i=Math.floor(r/60),u=r/60-i,a=o*(1-e),p=o*(1-u*e),b=o*(1-(1-u)*e);return i%6===0?(n=o,t=b,s=a):i%6===1?(n=p,t=o,s=a):i%6===2?(n=a,t=o,s=b):i%6===3?(n=a,t=p,s=o):i%6===4?(n=b,t=a,s=o):i%6===5&&(n=o,t=a,s=p),{b:Math.round(s*255),g:Math.round(t*255),r:Math.round(n*255)}};var j=({b:r,g:e,r:o})=>{let n,t,s,i=0,u=0;o/=255,e/=255,r/=255;let a=Math.max(o,e,r),p=a-Math.min(o,e,r),b=g=>(a-g)/6/p+1/2;return p!==0&&(u=p/a,n=b(o),t=b(e),s=b(r),a===o?i=s-t:a===e?i=.3333333333333333+n-s:a===r&&(i=.6666666666666666+t-n),i<0?i+=1:i>1&&(i-=1)),{h:i*360,s:u,v:a}};var ee={b:256,g:256,r:256},re={h:360,s:1,v:1},$=(r,e,o)=>{let n={};for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=o===0?0:(e[t]-r[t])/o);return n},J=(r,e,o,n)=>{let t={};for(let s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=r[s]*o+e[s],t[s]=t[s]<0?t[s]+n[s]:n[s]===1?t[s]:t[s]%n[s]);return t},k=(r,e,o)=>{let n={b:r.color[2],g:r.color[1],r:r.color[0]},t={b:e.color[2],g:e.color[1],r:e.color[0]},s=$(n,t,o),i=[{...n}];for(let u=1;u<o;u++){let a=J(s,n,u,ee);i.push({b:Math.floor(a.b),g:Math.floor(a.g),r:Math.floor(a.r)});}return i},V=(r,e,o,n)=>{let t=j({b:r.color[2],g:r.color[1],r:r.color[0]}),s=j({b:e.color[2],g:e.color[1],r:e.color[0]});if(t.s===0||s.s===0)return k(r,e,o);let i;if(typeof n=="boolean")i=n;else {let b=t.h<s.h&&s.h-t.h<180||t.h>s.h&&t.h-s.h>180;i=n==="long"&&b||n==="short"&&!b;}let u=$(t,s,o),a=[{b:r.color[2],g:r.color[1],r:r.color[0]}],p;t.h<=s.h&&!i||t.h>=s.h&&i?p=s.h-t.h:i?p=360-s.h+t.h:p=360-t.h+s.h,u.h=(-1)**(i?1:0)*Math.abs(p)/o;for(let b=1;b<o;b++){let g=J(u,t,b,re);a.push(Y(g.h,g.s,g.v));}return a};var C=class r{#e;stops;constructor(e,o){if(this.#e=e,this.stops=[],o.length<2)throw new Error("Invalid number of stops (< 2)");let n=o[0].position!==void 0,t=o.length,s=-1,i=!1;for(let[u,a]of o.entries()){let p={},b=a.position!==void 0;if(n!==b)throw new Error("Cannot mix positioned and non-positioned color stops");if(b){let g=a,y=g.color!==void 0;if(!y&&(i||u===0||u===t-1))throw new Error("Cannot define two consecutive position-only stops");i=!y;let f;if(y&&(Array.isArray(g.color)?f=g.color:typeof g.color=="string"?f=g.color.includes("#")?S(g.color):D[g.color]:g.color.r!==void 0&&g.color.g!==void 0&&g.color.b&&(f=[g.color.r,g.color.g,g.color.b])),p={color:f,colorLess:!y,position:g.position},p.position<0||p.position>1)throw new Error("Color stops positions must be between 0 and 1");if(p.position<s)throw new Error("Color stops positions are not ordered");s=p.position;}else if(Array.isArray(a))p={color:a,position:u/(t-1)};else if(typeof a=="string")p={color:a.includes("#")?S(a):D[a],position:u/(t-1)};else if(a.r!==void 0&&a.g!==void 0&&a.b!==void 0)p={color:[a.r,a.g,a.b],position:u/(t-1)};else throw new Error("Invalid color stop");this.stops.push(p);}this.stops[0].position!==0&&(this.stops.unshift({color:this.stops[0].color,position:0}),t++),this.stops[t-1].position!==1&&this.stops.push({color:this.stops[t-1].color,position:1});}reverse(){let e=[];for(let o of this.stops){let n={...o};n.position=1-o.position,e.push(n);}return new r(this.#e,e.reverse())}loop(){let e=[],o=[];for(let n of this.stops)e.push({color:n.color,position:(n.position||0)/2});for(let n of this.stops.slice(0,-1))o.push({color:n.color,position:1-(n.position||0)/2});return new r(this.#e,[...e,...o.reverse()])}rgb(e){let o=P(this.stops,e),n=[];this.stops.forEach((t,s)=>{if(t.colorLess){let i=k(this.stops[s-1],this.stops[s+1],2);t.color=[i[1].r,i[1].g,i[1].b];}});for(let t=0,s=this.stops.length;t<s-1;t++){let i=k(this.stops[t],this.stops[t+1],o[t]);n.splice(n.length,0,...i.map(u=>this.#e.rgb(u.r,u.g,u.b)));}return n.push(this.#e.rgb(...this.stops.at(-1).color)),n}hsv(e,o=!1){let n=P(this.stops,e),t=[];this.stops.forEach((s,i)=>{if(s.colorLess){let u=V(this.stops[i-1],this.stops[i+1],2,o);s.color=[u[1].r,u[1].g,u[1].b];}});for(let s=0,i=this.stops.length;s<i-1;s++){let u=V(this.stops[s],this.stops[s+1],n[s],o);t.splice(t.length,0,...u.map(a=>this.#e.rgb(a.r,a.g,a.b)));}return t.push(this.#e.rgb(...this.stops.at(-1).color)),t}};var K=new X,q=/\s/g,Ae=(r,e)=>{let{hsvSpin:o="short",interpolation:n="rgb"}=e??{},t=new C(K,r);return e?.loop?t=t.loop():e?.reverse&&(t=t.reverse()),s=>{let i=Math.max(s.replaceAll(q,"").length,t.stops.length),u=n==="rgb"?t.rgb(i):t.hsv(i,o),a="";for(let p of s)if(q.test(p))a+=p;else {let b=u.shift();a+=b(p);}return a}},Me=(r,e)=>{let{hsvSpin:o="short",interpolation:n="rgb"}=e??{},t=new C(K,r);return e?.loop?t=t.loop():e?.reverse&&(t=t.reverse()),s=>{let i=s.split(`
|
|
7
|
-
`),u=Reflect.apply(Math.max,null,[...i.map(b=>b.length),t.stops.length]),a=n==="rgb"?t.rgb(u):t.hsv(u,o),p=[];for(let b of i){let g=[...a],y="";for(let f of b)y+=q.test(f)?f:g.shift()(f);p.push(y);}return p.join(`
|
|
8
|
-
`)}};
|
|
9
|
-
|
|
10
|
-
exports.GradientBuilder = C;
|
|
11
|
-
exports.gradient = Ae;
|
|
12
|
-
exports.multilineGradient = Me;
|
|
13
|
-
//# sourceMappingURL=gradient.cjs.map
|
|
14
|
-
//# sourceMappingURL=gradient.cjs.map
|
|
1
|
+
"use strict";var G=Object.defineProperty;var f=(t,r)=>G(t,"name",{value:r,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("./packem_shared/colorize.server-BdZzymFP.cjs"),g=require("./packem_shared/GradientBuilder-Bn5OODm9.cjs");var y=Object.defineProperty,v=f((t,r)=>y(t,"name",{value:r,configurable:!0}),"c");const b=new B.m,d=/\s/g,S=v((t,r)=>{const{hsvSpin:u="short",interpolation:c="rgb"}=r??{};let e=new g.GradientBuilder(b,t);return r?.loop?e=e.loop():r?.reverse&&(e=e.reverse()),s=>{const o=Math.max(s.replaceAll(d,"").length,e.stops.length),a=c==="rgb"?e.rgb(o):e.hsv(o,u);let l="";for(const n of s)if(d.test(n))l+=n;else{const i=a.shift();l+=i(n)}return l}},"gradient"),j=v((t,r)=>{const{hsvSpin:u="short",interpolation:c="rgb"}=r??{};let e=new g.GradientBuilder(b,t);return r?.loop?e=e.loop():r?.reverse&&(e=e.reverse()),s=>{const o=s.split(`
|
|
2
|
+
`),a=Reflect.apply(Math.max,null,[...o.map(i=>i.length),e.stops.length]),l=c==="rgb"?e.rgb(a):e.hsv(a,u),n=[];for(const i of o){const m=[...l];let h="";for(const p of i)h+=d.test(p)?p:m.shift()(p);n.push(h)}return n.join(`
|
|
3
|
+
`)}},"multilineGradient");exports.GradientBuilder=g.GradientBuilder;exports.gradient=S;exports.multilineGradient=j;
|
package/dist/gradient.d.cts
CHANGED
|
@@ -1,82 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
interface ColorizeType {
|
|
3
|
-
(string: number | string): string;
|
|
4
|
-
(string: TemplateStringsArray, ...parameters: string[]): string;
|
|
5
|
-
ansi256: (code: number) => this;
|
|
6
|
-
bg: (code: number) => this;
|
|
7
|
-
bgAnsi256: (code: number) => this;
|
|
8
|
-
readonly bgBlack: this;
|
|
9
|
-
readonly bgBlackBright: this;
|
|
10
|
-
readonly bgBlue: this;
|
|
11
|
-
readonly bgBlueBright: this;
|
|
12
|
-
readonly bgCyan: this;
|
|
13
|
-
readonly bgCyanBright: this;
|
|
14
|
-
readonly bgGray: this;
|
|
15
|
-
readonly bgGreen: this;
|
|
16
|
-
readonly bgGreenBright: this;
|
|
17
|
-
readonly bgGrey: this;
|
|
18
|
-
bgHex: (color: ColorValueHex) => this;
|
|
19
|
-
readonly bgMagenta: this;
|
|
20
|
-
readonly bgMagentaBright: this;
|
|
21
|
-
readonly bgRed: this;
|
|
22
|
-
readonly bgRedBright: this;
|
|
23
|
-
bgRgb: (red: number, green: number, blue: number) => this;
|
|
24
|
-
readonly bgWhite: this;
|
|
25
|
-
readonly bgWhiteBright: this;
|
|
26
|
-
readonly bgYellow: this;
|
|
27
|
-
readonly bgYellowBright: this;
|
|
28
|
-
readonly black: this;
|
|
29
|
-
readonly blackBright: this;
|
|
30
|
-
readonly blue: this;
|
|
31
|
-
readonly blueBright: this;
|
|
32
|
-
readonly bold: this;
|
|
33
|
-
readonly close: string;
|
|
34
|
-
readonly cyan: this;
|
|
35
|
-
readonly cyanBright: this;
|
|
36
|
-
readonly dim: this;
|
|
37
|
-
fg: (code: number) => this;
|
|
38
|
-
readonly gray: this;
|
|
39
|
-
readonly green: this;
|
|
40
|
-
readonly greenBright: this;
|
|
41
|
-
readonly grey: this;
|
|
42
|
-
hex: (color: ColorValueHex) => this;
|
|
43
|
-
readonly hidden: this;
|
|
44
|
-
readonly inverse: this;
|
|
45
|
-
readonly italic: this;
|
|
46
|
-
readonly magenta: this;
|
|
47
|
-
readonly magentaBright: this;
|
|
48
|
-
readonly open: string;
|
|
49
|
-
readonly overline: this;
|
|
50
|
-
readonly red: this;
|
|
51
|
-
readonly redBright: this;
|
|
52
|
-
readonly reset: this;
|
|
53
|
-
rgb: (red: number, green: number, blue: number) => this;
|
|
54
|
-
readonly strike: this;
|
|
55
|
-
readonly strikethrough: this;
|
|
56
|
-
strip: (string: string) => string;
|
|
57
|
-
readonly underline: this;
|
|
58
|
-
readonly visible: this;
|
|
59
|
-
readonly white: this;
|
|
60
|
-
readonly whiteBright: this;
|
|
61
|
-
readonly yellow: this;
|
|
62
|
-
readonly yellowBright: this;
|
|
63
|
-
}
|
|
64
|
-
type CssColorName = "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blue" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "cyan" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "gold" | "goldenrod" | "gray" | "green" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "lime" | "limegreen" | "linen" | "magenta" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orange" | "orangered" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "purple" | "rebeccapurple" | "red" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen";
|
|
65
|
-
type StopInput = {
|
|
66
|
-
color?: ColorValueHex | CssColorName | RGB | [number, number, number];
|
|
67
|
-
colorLess?: boolean;
|
|
68
|
-
position: number;
|
|
69
|
-
};
|
|
70
|
-
type StopOutput = {
|
|
71
|
-
color: [number, number, number] | undefined;
|
|
72
|
-
colorLess?: boolean;
|
|
73
|
-
position: number;
|
|
74
|
-
};
|
|
75
|
-
type RGB = {
|
|
76
|
-
b: number;
|
|
77
|
-
g: number;
|
|
78
|
-
r: number;
|
|
79
|
-
};
|
|
1
|
+
import { S as StopOutput, C as ColorizeType, a as ColorValueHex, b as CssColorName, R as RGB, c as StopInput } from './packem_shared/types-CuuGv4d0.cjs';
|
|
80
2
|
|
|
81
3
|
declare class GradientBuilder {
|
|
82
4
|
#private;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { S as StopOutput, C as ColorizeType, a as ColorValueHex, b as CssColorName, R as RGB, c as StopInput } from './packem_shared/types-CuuGv4d0.mjs';
|
|
2
|
+
|
|
3
|
+
declare class GradientBuilder {
|
|
4
|
+
#private;
|
|
5
|
+
readonly stops: StopOutput[];
|
|
6
|
+
constructor(colorize: ColorizeType, stops: (ColorValueHex | CssColorName | RGB | StopInput | [number, number, number])[]);
|
|
7
|
+
reverse(): GradientBuilder;
|
|
8
|
+
loop(): GradientBuilder;
|
|
9
|
+
rgb(steps: number): ColorizeType[];
|
|
10
|
+
hsv(steps: number, mode?: boolean | "long" | "short"): ColorizeType[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare const gradient: (stops: (ColorValueHex | CssColorName | RGB | StopInput | [
|
|
14
|
+
number,
|
|
15
|
+
number,
|
|
16
|
+
number
|
|
17
|
+
])[], options?: {
|
|
18
|
+
hsvSpin?: "long" | "short";
|
|
19
|
+
interpolation?: "hsv" | "rgb";
|
|
20
|
+
loop?: boolean;
|
|
21
|
+
reverse?: boolean;
|
|
22
|
+
}) => ((string_: string) => string);
|
|
23
|
+
declare const multilineGradient: (stops: (ColorValueHex | CssColorName | RGB | StopInput | [
|
|
24
|
+
number,
|
|
25
|
+
number,
|
|
26
|
+
number
|
|
27
|
+
])[], options?: {
|
|
28
|
+
hsvSpin?: "long" | "short";
|
|
29
|
+
interpolation?: "hsv" | "rgb";
|
|
30
|
+
loop?: boolean;
|
|
31
|
+
reverse?: boolean;
|
|
32
|
+
}) => ((string_: string) => string);
|
|
33
|
+
|
|
34
|
+
export { GradientBuilder, gradient, multilineGradient };
|
package/dist/gradient.d.ts
CHANGED
|
@@ -1,82 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
interface ColorizeType {
|
|
3
|
-
(string: number | string): string;
|
|
4
|
-
(string: TemplateStringsArray, ...parameters: string[]): string;
|
|
5
|
-
ansi256: (code: number) => this;
|
|
6
|
-
bg: (code: number) => this;
|
|
7
|
-
bgAnsi256: (code: number) => this;
|
|
8
|
-
readonly bgBlack: this;
|
|
9
|
-
readonly bgBlackBright: this;
|
|
10
|
-
readonly bgBlue: this;
|
|
11
|
-
readonly bgBlueBright: this;
|
|
12
|
-
readonly bgCyan: this;
|
|
13
|
-
readonly bgCyanBright: this;
|
|
14
|
-
readonly bgGray: this;
|
|
15
|
-
readonly bgGreen: this;
|
|
16
|
-
readonly bgGreenBright: this;
|
|
17
|
-
readonly bgGrey: this;
|
|
18
|
-
bgHex: (color: ColorValueHex) => this;
|
|
19
|
-
readonly bgMagenta: this;
|
|
20
|
-
readonly bgMagentaBright: this;
|
|
21
|
-
readonly bgRed: this;
|
|
22
|
-
readonly bgRedBright: this;
|
|
23
|
-
bgRgb: (red: number, green: number, blue: number) => this;
|
|
24
|
-
readonly bgWhite: this;
|
|
25
|
-
readonly bgWhiteBright: this;
|
|
26
|
-
readonly bgYellow: this;
|
|
27
|
-
readonly bgYellowBright: this;
|
|
28
|
-
readonly black: this;
|
|
29
|
-
readonly blackBright: this;
|
|
30
|
-
readonly blue: this;
|
|
31
|
-
readonly blueBright: this;
|
|
32
|
-
readonly bold: this;
|
|
33
|
-
readonly close: string;
|
|
34
|
-
readonly cyan: this;
|
|
35
|
-
readonly cyanBright: this;
|
|
36
|
-
readonly dim: this;
|
|
37
|
-
fg: (code: number) => this;
|
|
38
|
-
readonly gray: this;
|
|
39
|
-
readonly green: this;
|
|
40
|
-
readonly greenBright: this;
|
|
41
|
-
readonly grey: this;
|
|
42
|
-
hex: (color: ColorValueHex) => this;
|
|
43
|
-
readonly hidden: this;
|
|
44
|
-
readonly inverse: this;
|
|
45
|
-
readonly italic: this;
|
|
46
|
-
readonly magenta: this;
|
|
47
|
-
readonly magentaBright: this;
|
|
48
|
-
readonly open: string;
|
|
49
|
-
readonly overline: this;
|
|
50
|
-
readonly red: this;
|
|
51
|
-
readonly redBright: this;
|
|
52
|
-
readonly reset: this;
|
|
53
|
-
rgb: (red: number, green: number, blue: number) => this;
|
|
54
|
-
readonly strike: this;
|
|
55
|
-
readonly strikethrough: this;
|
|
56
|
-
strip: (string: string) => string;
|
|
57
|
-
readonly underline: this;
|
|
58
|
-
readonly visible: this;
|
|
59
|
-
readonly white: this;
|
|
60
|
-
readonly whiteBright: this;
|
|
61
|
-
readonly yellow: this;
|
|
62
|
-
readonly yellowBright: this;
|
|
63
|
-
}
|
|
64
|
-
type CssColorName = "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blue" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "cyan" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "gold" | "goldenrod" | "gray" | "green" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "lime" | "limegreen" | "linen" | "magenta" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orange" | "orangered" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "purple" | "rebeccapurple" | "red" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen";
|
|
65
|
-
type StopInput = {
|
|
66
|
-
color?: ColorValueHex | CssColorName | RGB | [number, number, number];
|
|
67
|
-
colorLess?: boolean;
|
|
68
|
-
position: number;
|
|
69
|
-
};
|
|
70
|
-
type StopOutput = {
|
|
71
|
-
color: [number, number, number] | undefined;
|
|
72
|
-
colorLess?: boolean;
|
|
73
|
-
position: number;
|
|
74
|
-
};
|
|
75
|
-
type RGB = {
|
|
76
|
-
b: number;
|
|
77
|
-
g: number;
|
|
78
|
-
r: number;
|
|
79
|
-
};
|
|
1
|
+
import { S as StopOutput, C as ColorizeType, a as ColorValueHex, b as CssColorName, R as RGB, c as StopInput } from './packem_shared/types-CuuGv4d0.d.mjs';
|
|
80
2
|
|
|
81
3
|
declare class GradientBuilder {
|
|
82
4
|
#private;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var w=Object.defineProperty;var u=(r,e)=>w(r,"name",{value:e,configurable:!0});import{m as x}from"./packem_shared/colorize.server-BayBPE0C.mjs";import{GradientBuilder as v}from"./packem_shared/GradientBuilder-CL8ERRQu.mjs";var G=Object.defineProperty,m=u((r,e)=>G(r,"name",{value:e,configurable:!0}),"c");const b=new x,f=/\s/g,S=m((r,e)=>{const{hsvSpin:a="short",interpolation:c="rgb"}=e??{};let t=new v(b,r);return e?.loop?t=t.loop():e?.reverse&&(t=t.reverse()),i=>{const n=Math.max(i.replaceAll(f,"").length,t.stops.length),p=c==="rgb"?t.rgb(n):t.hsv(n,a);let s="";for(const o of i)if(f.test(o))s+=o;else{const l=p.shift();s+=l(o)}return s}},"gradient"),A=m((r,e)=>{const{hsvSpin:a="short",interpolation:c="rgb"}=e??{};let t=new v(b,r);return e?.loop?t=t.loop():e?.reverse&&(t=t.reverse()),i=>{const n=i.split(`
|
|
2
|
+
`),p=Reflect.apply(Math.max,null,[...n.map(l=>l.length),t.stops.length]),s=c==="rgb"?t.rgb(p):t.hsv(p,a),o=[];for(const l of n){const d=[...s];let g="";for(const h of l)g+=f.test(h)?h:d.shift()(h);o.push(g)}return o.join(`
|
|
3
|
+
`)}},"multilineGradient");export{v as GradientBuilder,S as gradient,A as multilineGradient};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { C as ColorizeType } from './packem_shared/types-CoLB2PX2.mjs';
|
|
2
|
+
export { A as AnsiColors, a as AnsiStyles } from './packem_shared/types-CoLB2PX2.mjs';
|
|
3
|
+
|
|
4
|
+
declare const WebColorize: new () => ColorizeType;
|
|
5
|
+
|
|
6
|
+
declare const _default: ColorizeType;
|
|
7
|
+
|
|
8
|
+
declare const ansi256: (code: number) => ColorizeType;
|
|
9
|
+
declare const bg: (code: number) => ColorizeType;
|
|
10
|
+
declare const bgAnsi256: (code: number) => ColorizeType;
|
|
11
|
+
declare const bgBlack: ColorizeType;
|
|
12
|
+
declare const bgBlackBright: ColorizeType;
|
|
13
|
+
declare const bgBlue: ColorizeType;
|
|
14
|
+
declare const bgBlueBright: ColorizeType;
|
|
15
|
+
declare const bgCyan: ColorizeType;
|
|
16
|
+
declare const bgCyanBright: ColorizeType;
|
|
17
|
+
declare const bgGray: ColorizeType;
|
|
18
|
+
declare const bgGreen: ColorizeType;
|
|
19
|
+
declare const bgGreenBright: ColorizeType;
|
|
20
|
+
declare const bgGrey: ColorizeType;
|
|
21
|
+
declare const bgHex: (color: `#${string}`) => ColorizeType;
|
|
22
|
+
declare const bgMagenta: ColorizeType;
|
|
23
|
+
declare const bgMagentaBright: ColorizeType;
|
|
24
|
+
declare const bgRed: ColorizeType;
|
|
25
|
+
declare const bgRedBright: ColorizeType;
|
|
26
|
+
declare const bgRgb: (red: number, green: number, blue: number) => ColorizeType;
|
|
27
|
+
declare const bgWhite: ColorizeType;
|
|
28
|
+
declare const bgWhiteBright: ColorizeType;
|
|
29
|
+
declare const bgYellow: ColorizeType;
|
|
30
|
+
declare const bgYellowBright: ColorizeType;
|
|
31
|
+
declare const black: ColorizeType;
|
|
32
|
+
declare const blackBright: ColorizeType;
|
|
33
|
+
declare const blue: ColorizeType;
|
|
34
|
+
declare const blueBright: ColorizeType;
|
|
35
|
+
declare const bold: ColorizeType;
|
|
36
|
+
declare const cyan: ColorizeType;
|
|
37
|
+
declare const cyanBright: ColorizeType;
|
|
38
|
+
declare const dim: ColorizeType;
|
|
39
|
+
declare const fg: (code: number) => ColorizeType;
|
|
40
|
+
declare const gray: ColorizeType;
|
|
41
|
+
declare const green: ColorizeType;
|
|
42
|
+
declare const greenBright: ColorizeType;
|
|
43
|
+
declare const grey: ColorizeType;
|
|
44
|
+
declare const hex: (color: `#${string}`) => ColorizeType;
|
|
45
|
+
declare const hidden: ColorizeType;
|
|
46
|
+
declare const inverse: ColorizeType;
|
|
47
|
+
declare const italic: ColorizeType;
|
|
48
|
+
declare const magenta: ColorizeType;
|
|
49
|
+
declare const magentaBright: ColorizeType;
|
|
50
|
+
declare const overline: ColorizeType;
|
|
51
|
+
declare const red: ColorizeType;
|
|
52
|
+
declare const redBright: ColorizeType;
|
|
53
|
+
declare const reset: ColorizeType;
|
|
54
|
+
declare const rgb: (red: number, green: number, blue: number) => ColorizeType;
|
|
55
|
+
declare const strike: ColorizeType;
|
|
56
|
+
declare const strikethrough: ColorizeType;
|
|
57
|
+
declare const strip: (string: string) => string;
|
|
58
|
+
declare const underline: ColorizeType;
|
|
59
|
+
declare const visible: ColorizeType;
|
|
60
|
+
declare const white: ColorizeType;
|
|
61
|
+
declare const whiteBright: ColorizeType;
|
|
62
|
+
declare const yellow: ColorizeType;
|
|
63
|
+
declare const yellowBright: ColorizeType;
|
|
64
|
+
|
|
65
|
+
export { WebColorize as Colorize, ColorizeType, ansi256, bg, bgAnsi256, bgBlack, bgBlackBright, bgBlue, bgBlueBright, bgCyan, bgCyanBright, bgGray, bgGreen, bgGreenBright, bgGrey, bgHex, bgMagenta, bgMagentaBright, bgRed, bgRedBright, bgRgb, bgWhite, bgWhiteBright, bgYellow, bgYellowBright, black, blackBright, blue, blueBright, bold, cyan, cyanBright, _default as default, dim, fg, gray, green, greenBright, grey, hex, hidden, inverse, italic, magenta, magentaBright, overline, red, redBright, reset, rgb, strike, strikethrough, strip, underline, visible, white, whiteBright, yellow, yellowBright };
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -1,68 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
(string: number | string): string;
|
|
4
|
-
(string: TemplateStringsArray, ...parameters: string[]): string;
|
|
5
|
-
ansi256: (code: number) => this;
|
|
6
|
-
bg: (code: number) => this;
|
|
7
|
-
bgAnsi256: (code: number) => this;
|
|
8
|
-
readonly bgBlack: this;
|
|
9
|
-
readonly bgBlackBright: this;
|
|
10
|
-
readonly bgBlue: this;
|
|
11
|
-
readonly bgBlueBright: this;
|
|
12
|
-
readonly bgCyan: this;
|
|
13
|
-
readonly bgCyanBright: this;
|
|
14
|
-
readonly bgGray: this;
|
|
15
|
-
readonly bgGreen: this;
|
|
16
|
-
readonly bgGreenBright: this;
|
|
17
|
-
readonly bgGrey: this;
|
|
18
|
-
bgHex: (color: ColorValueHex) => this;
|
|
19
|
-
readonly bgMagenta: this;
|
|
20
|
-
readonly bgMagentaBright: this;
|
|
21
|
-
readonly bgRed: this;
|
|
22
|
-
readonly bgRedBright: this;
|
|
23
|
-
bgRgb: (red: number, green: number, blue: number) => this;
|
|
24
|
-
readonly bgWhite: this;
|
|
25
|
-
readonly bgWhiteBright: this;
|
|
26
|
-
readonly bgYellow: this;
|
|
27
|
-
readonly bgYellowBright: this;
|
|
28
|
-
readonly black: this;
|
|
29
|
-
readonly blackBright: this;
|
|
30
|
-
readonly blue: this;
|
|
31
|
-
readonly blueBright: this;
|
|
32
|
-
readonly bold: this;
|
|
33
|
-
readonly close: string;
|
|
34
|
-
readonly cyan: this;
|
|
35
|
-
readonly cyanBright: this;
|
|
36
|
-
readonly dim: this;
|
|
37
|
-
fg: (code: number) => this;
|
|
38
|
-
readonly gray: this;
|
|
39
|
-
readonly green: this;
|
|
40
|
-
readonly greenBright: this;
|
|
41
|
-
readonly grey: this;
|
|
42
|
-
hex: (color: ColorValueHex) => this;
|
|
43
|
-
readonly hidden: this;
|
|
44
|
-
readonly inverse: this;
|
|
45
|
-
readonly italic: this;
|
|
46
|
-
readonly magenta: this;
|
|
47
|
-
readonly magentaBright: this;
|
|
48
|
-
readonly open: string;
|
|
49
|
-
readonly overline: this;
|
|
50
|
-
readonly red: this;
|
|
51
|
-
readonly redBright: this;
|
|
52
|
-
readonly reset: this;
|
|
53
|
-
rgb: (red: number, green: number, blue: number) => this;
|
|
54
|
-
readonly strike: this;
|
|
55
|
-
readonly strikethrough: this;
|
|
56
|
-
strip: (string: string) => string;
|
|
57
|
-
readonly underline: this;
|
|
58
|
-
readonly visible: this;
|
|
59
|
-
readonly white: this;
|
|
60
|
-
readonly whiteBright: this;
|
|
61
|
-
readonly yellow: this;
|
|
62
|
-
readonly yellowBright: this;
|
|
63
|
-
}
|
|
64
|
-
type AnsiStyles = "bold" | "dim" | "hidden" | "inverse" | "italic" | "overline" | "reset" | "strike" | "strikethrough" | "underline" | "visible";
|
|
65
|
-
type AnsiColors = "bgBlack" | "bgBlackBright" | "bgBlue" | "bgBlueBright" | "bgCyan" | "bgCyanBright" | "bgGray" | "bgGreen" | "bgGreenBright" | "bgGrey" | "bgMagenta" | "bgMagentaBright" | "bgRed" | "bgRedBright" | "bgWhite" | "bgWhiteBright" | "bgYellow" | "bgYellowBright" | "black" | "blackBright" | "blue" | "blueBright" | "cyan" | "cyanBright" | "gray" | "green" | "greenBright" | "grey" | "magenta" | "magentaBright" | "red" | "redBright" | "white" | "whiteBright" | "yellow" | "yellowBright";
|
|
1
|
+
import { C as ColorizeType } from './packem_shared/types-CoLB2PX2.d.mjs';
|
|
2
|
+
export { A as AnsiColors, a as AnsiStyles } from './packem_shared/types-CoLB2PX2.d.mjs';
|
|
66
3
|
|
|
67
4
|
declare const WebColorize: new () => ColorizeType;
|
|
68
5
|
|
|
@@ -125,4 +62,4 @@ declare const whiteBright: ColorizeType;
|
|
|
125
62
|
declare const yellow: ColorizeType;
|
|
126
63
|
declare const yellowBright: ColorizeType;
|
|
127
64
|
|
|
128
|
-
export {
|
|
65
|
+
export { WebColorize as Colorize, ColorizeType, ansi256, bg, bgAnsi256, bgBlack, bgBlackBright, bgBlue, bgBlueBright, bgCyan, bgCyanBright, bgGray, bgGreen, bgGreenBright, bgGrey, bgHex, bgMagenta, bgMagentaBright, bgRed, bgRedBright, bgRgb, bgWhite, bgWhiteBright, bgYellow, bgYellowBright, black, blackBright, blue, blueBright, bold, cyan, cyanBright, _default as default, dim, fg, gray, green, greenBright, grey, hex, hidden, inverse, italic, magenta, magentaBright, overline, red, redBright, reset, rgb, strike, strikethrough, strip, underline, visible, white, whiteBright, yellow, yellowBright };
|