@visulima/colorize 1.4.27 → 1.4.28
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 +24 -0
- package/dist/ansi-codes.d.cts +18 -0
- package/dist/ansi-codes.d.mts +18 -0
- package/dist/ansi-codes.d.ts +18 -0
- package/dist/colorize.browser.d.mts +3 -0
- package/dist/colorize.server.d.cts +10 -0
- package/dist/colorize.server.d.mts +10 -0
- package/dist/colorize.server.d.ts +10 -0
- package/dist/css-code.d.mts +11 -0
- package/dist/gradient/gradient-builder.d.cts +10 -0
- package/dist/gradient/gradient-builder.d.mts +10 -0
- package/dist/gradient/gradient-builder.d.ts +10 -0
- package/dist/gradient/util/color-names.d.cts +2 -0
- package/dist/gradient/util/color-names.d.mts +2 -0
- package/dist/gradient/util/color-names.d.ts +2 -0
- package/dist/gradient/util/compute.d.cts +2 -0
- package/dist/gradient/util/compute.d.mts +2 -0
- package/dist/gradient/util/compute.d.ts +2 -0
- package/dist/gradient/util/hsv-to-rgb.d.cts +5 -0
- package/dist/gradient/util/hsv-to-rgb.d.mts +5 -0
- package/dist/gradient/util/hsv-to-rgb.d.ts +5 -0
- package/dist/gradient/util/interpolate.d.cts +3 -0
- package/dist/gradient/util/interpolate.d.mts +3 -0
- package/dist/gradient/util/interpolate.d.ts +3 -0
- package/dist/gradient/util/rgb-to-hsv.d.cts +9 -0
- package/dist/gradient/util/rgb-to-hsv.d.mts +9 -0
- package/dist/gradient/util/rgb-to-hsv.d.ts +9 -0
- package/dist/gradient.d.cts +4 -16
- package/dist/gradient.d.mts +4 -16
- package/dist/gradient.d.ts +4 -16
- package/dist/index.browser.d.mts +60 -64
- package/dist/index.browser.mjs +56 -58
- package/dist/index.server.cjs +3 -6
- package/dist/index.server.d.cts +7 -73
- package/dist/index.server.d.mts +60 -64
- package/dist/index.server.d.ts +8 -65
- package/dist/index.server.mjs +56 -58
- package/dist/template/make-colorize-template.d.cts +9 -0
- package/dist/template/make-colorize-template.d.mts +9 -0
- package/dist/template/make-colorize-template.d.ts +9 -0
- package/dist/template/make-template.d.cts +10 -0
- package/dist/template/make-template.d.mts +10 -0
- package/dist/template/make-template.d.ts +10 -0
- package/dist/template.cjs +2 -2
- package/dist/template.d.cts +5 -11
- package/dist/template.d.mts +5 -7
- package/dist/template.d.ts +5 -11
- package/dist/template.mjs +2 -2
- package/dist/types.d.cts +174 -0
- package/dist/types.d.mts +174 -0
- package/dist/types.d.ts +174 -0
- package/dist/util/ansi-code-hex-map.d.mts +8 -0
- package/dist/util/clamp.d.cts +12 -0
- package/dist/util/clamp.d.mts +12 -0
- package/dist/util/clamp.d.ts +12 -0
- package/dist/util/convert-hex-to-rgb.d.cts +22 -0
- package/dist/util/convert-hex-to-rgb.d.mts +22 -0
- package/dist/util/convert-hex-to-rgb.d.ts +22 -0
- package/dist/util/convert-rgb-to-ansi.d.cts +18 -0
- package/dist/util/convert-rgb-to-ansi.d.mts +18 -0
- package/dist/util/convert-rgb-to-ansi.d.ts +18 -0
- package/dist/util/string-replace-all.d.cts +12 -0
- package/dist/util/string-replace-all.d.mts +12 -0
- package/dist/util/string-replace-all.d.ts +12 -0
- package/dist/util/unescape.d.cts +9 -0
- package/dist/util/unescape.d.mts +9 -0
- package/dist/util/unescape.d.ts +9 -0
- package/dist/utils.d.cts +2 -9
- package/dist/utils.d.mts +2 -9
- package/dist/utils.d.ts +2 -9
- package/package.json +2 -2
- package/dist/index.browser.d.ts +0 -65
- package/dist/packem_shared/types-CuuGv4d0.d.cts +0 -81
- package/dist/packem_shared/types-CuuGv4d0.d.mts +0 -81
- package/dist/packem_shared/types-CuuGv4d0.d.ts +0 -81
- package/dist/packem_shared/types-M28Oe2t1.d.mts +0 -67
- package/dist/packem_shared/types-M28Oe2t1.d.ts +0 -67
package/dist/types.d.cts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
export type ColorValueHex = `#${string}`;
|
|
2
|
+
export interface ColorizeType {
|
|
3
|
+
/**
|
|
4
|
+
* Return styled string.
|
|
5
|
+
* @param {string | TemplateStringsArray} string
|
|
6
|
+
*/
|
|
7
|
+
(string: number | string): string;
|
|
8
|
+
(string: TemplateStringsArray, ...parameters: string[]): string;
|
|
9
|
+
/**
|
|
10
|
+
* Set [256-color ANSI code](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) for foreground color.
|
|
11
|
+
*
|
|
12
|
+
* Code ranges:
|
|
13
|
+
* ```
|
|
14
|
+
* 0 - 7: standard colors
|
|
15
|
+
* 8 - 15: high intensity colors
|
|
16
|
+
* 16 - 231: 6 × 6 × 6 cube (216 colors)
|
|
17
|
+
* 232 - 255: grayscale from black to white in 24 steps
|
|
18
|
+
* ```
|
|
19
|
+
* @param {number} code in range [0, 255].
|
|
20
|
+
*/
|
|
21
|
+
ansi256: (code: number) => this;
|
|
22
|
+
/**
|
|
23
|
+
* Alias for bgAnsi256.
|
|
24
|
+
* @param {number} code in range [0, 255].
|
|
25
|
+
*/
|
|
26
|
+
bg: (code: number) => this;
|
|
27
|
+
/**
|
|
28
|
+
* Set [256-color ANSI code](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) for background color.
|
|
29
|
+
*
|
|
30
|
+
* Code ranges:
|
|
31
|
+
* ```
|
|
32
|
+
* 0 - 7: standard colors
|
|
33
|
+
* 8 - 15: high intensity colors
|
|
34
|
+
* 16 - 231: 6 × 6 × 6 cube (216 colors)
|
|
35
|
+
* 232 - 255: grayscale from black to white in 24 steps
|
|
36
|
+
* ```
|
|
37
|
+
* @param {number} code in range [0, 255].
|
|
38
|
+
*/
|
|
39
|
+
bgAnsi256: (code: number) => this;
|
|
40
|
+
readonly bgBlack: this;
|
|
41
|
+
readonly bgBlackBright: this;
|
|
42
|
+
readonly bgBlue: this;
|
|
43
|
+
readonly bgBlueBright: this;
|
|
44
|
+
readonly bgCyan: this;
|
|
45
|
+
readonly bgCyanBright: this;
|
|
46
|
+
readonly bgGray: this;
|
|
47
|
+
readonly bgGreen: this;
|
|
48
|
+
readonly bgGreenBright: this;
|
|
49
|
+
readonly bgGrey: this;
|
|
50
|
+
/**
|
|
51
|
+
* Set HEX value for background color.
|
|
52
|
+
* @param {string} hex
|
|
53
|
+
*/
|
|
54
|
+
bgHex: (color: ColorValueHex) => this;
|
|
55
|
+
readonly bgMagenta: this;
|
|
56
|
+
readonly bgMagentaBright: this;
|
|
57
|
+
readonly bgRed: this;
|
|
58
|
+
readonly bgRedBright: this;
|
|
59
|
+
/**
|
|
60
|
+
* Set RGB values for background color.
|
|
61
|
+
* @param {number} red The red value, in range [0, 255].
|
|
62
|
+
* @param {number} green The green value, in range [0, 255].
|
|
63
|
+
* @param {number} blue The blue value, in range [0, 255].
|
|
64
|
+
*/
|
|
65
|
+
bgRgb: (red: number, green: number, blue: number) => this;
|
|
66
|
+
readonly bgWhite: this;
|
|
67
|
+
readonly bgWhiteBright: this;
|
|
68
|
+
readonly bgYellow: this;
|
|
69
|
+
readonly bgYellowBright: this;
|
|
70
|
+
readonly black: this;
|
|
71
|
+
readonly blackBright: this;
|
|
72
|
+
readonly blue: this;
|
|
73
|
+
readonly blueBright: this;
|
|
74
|
+
/** <b>Bold</b> style (high intensity). */
|
|
75
|
+
readonly bold: this;
|
|
76
|
+
/** The ANSI escape sequences for ending the current style. */
|
|
77
|
+
readonly close: string;
|
|
78
|
+
readonly cyan: this;
|
|
79
|
+
readonly cyanBright: this;
|
|
80
|
+
/** Faint style (low intensity or dim). */
|
|
81
|
+
readonly dim: this;
|
|
82
|
+
/**
|
|
83
|
+
* Alias for ansi256.
|
|
84
|
+
* @param {number} code in range [0, 255].
|
|
85
|
+
*/
|
|
86
|
+
fg: (code: number) => this;
|
|
87
|
+
readonly gray: this;
|
|
88
|
+
readonly green: this;
|
|
89
|
+
readonly greenBright: this;
|
|
90
|
+
readonly grey: this;
|
|
91
|
+
/**
|
|
92
|
+
* Set HEX value for foreground color.
|
|
93
|
+
* @param {string} hex
|
|
94
|
+
*/
|
|
95
|
+
hex: (color: ColorValueHex) => this;
|
|
96
|
+
/** Print the invisible text. */
|
|
97
|
+
readonly hidden: this;
|
|
98
|
+
/** Invert background and foreground colors. */
|
|
99
|
+
readonly inverse: this;
|
|
100
|
+
/** <i>Italic</i> style. (Not widely supported) */
|
|
101
|
+
readonly italic: this;
|
|
102
|
+
readonly magenta: this;
|
|
103
|
+
readonly magentaBright: this;
|
|
104
|
+
/** The ANSI escape sequences for starting the current style. */
|
|
105
|
+
readonly open: string;
|
|
106
|
+
/** O̅v̅e̅r̅l̅i̅n̅e̅ style. (Not widely supported) */
|
|
107
|
+
readonly overline: this;
|
|
108
|
+
readonly red: this;
|
|
109
|
+
readonly redBright: this;
|
|
110
|
+
/** Reset the current style. */
|
|
111
|
+
readonly reset: this;
|
|
112
|
+
/**
|
|
113
|
+
* Set RGB values for foreground color.
|
|
114
|
+
* @param {number} red The red value, in range [0, 255].
|
|
115
|
+
* @param {number} green The green value, in range [0, 255].
|
|
116
|
+
* @param {number} blue The blue value, in range [0, 255].
|
|
117
|
+
*/
|
|
118
|
+
rgb: (red: number, green: number, blue: number) => this;
|
|
119
|
+
/** S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style. (Not widely supported) The alias for `strikethrough`. */
|
|
120
|
+
readonly strike: this;
|
|
121
|
+
/** S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style. (Not widely supported) */
|
|
122
|
+
readonly strikethrough: this;
|
|
123
|
+
/**
|
|
124
|
+
* Remove ANSI styling codes.
|
|
125
|
+
* @param {string} str
|
|
126
|
+
* @returns {string}
|
|
127
|
+
*/
|
|
128
|
+
strip: (string: string) => string;
|
|
129
|
+
/** U̲n̲d̲e̲r̲l̲i̲n̲e̲ style. (Not widely supported) */
|
|
130
|
+
readonly underline: this;
|
|
131
|
+
/** Print visible text without ANSI styling. */
|
|
132
|
+
readonly visible: this;
|
|
133
|
+
readonly white: this;
|
|
134
|
+
readonly whiteBright: this;
|
|
135
|
+
readonly yellow: this;
|
|
136
|
+
readonly yellowBright: this;
|
|
137
|
+
}
|
|
138
|
+
export type ColorData = {
|
|
139
|
+
close: string;
|
|
140
|
+
open: string;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Base ANSI Styles
|
|
144
|
+
*/
|
|
145
|
+
export type AnsiStyles = "bold" | "dim" | "hidden" | "inverse" | "italic" | "overline" | "reset" | "strike" | "strikethrough" | "underline" | "visible";
|
|
146
|
+
/**
|
|
147
|
+
* Base ANSI Colors
|
|
148
|
+
*/
|
|
149
|
+
export 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";
|
|
150
|
+
export 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";
|
|
151
|
+
export type CssColorCodes = {
|
|
152
|
+
[key in CssColorName]: [number, number, number];
|
|
153
|
+
};
|
|
154
|
+
export type StopInput = {
|
|
155
|
+
color?: ColorValueHex | CssColorName | RGB | [number, number, number];
|
|
156
|
+
colorLess?: boolean;
|
|
157
|
+
position: number;
|
|
158
|
+
};
|
|
159
|
+
export type StopOutput = {
|
|
160
|
+
color: [number, number, number] | undefined;
|
|
161
|
+
colorLess?: boolean;
|
|
162
|
+
position: number;
|
|
163
|
+
};
|
|
164
|
+
export type RGB = {
|
|
165
|
+
b: number;
|
|
166
|
+
g: number;
|
|
167
|
+
r: number;
|
|
168
|
+
};
|
|
169
|
+
export type HSVA = {
|
|
170
|
+
a?: number;
|
|
171
|
+
h: number;
|
|
172
|
+
s: number;
|
|
173
|
+
v: number;
|
|
174
|
+
};
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
export type ColorValueHex = `#${string}`;
|
|
2
|
+
export interface ColorizeType {
|
|
3
|
+
/**
|
|
4
|
+
* Return styled string.
|
|
5
|
+
* @param {string | TemplateStringsArray} string
|
|
6
|
+
*/
|
|
7
|
+
(string: number | string): string;
|
|
8
|
+
(string: TemplateStringsArray, ...parameters: string[]): string;
|
|
9
|
+
/**
|
|
10
|
+
* Set [256-color ANSI code](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) for foreground color.
|
|
11
|
+
*
|
|
12
|
+
* Code ranges:
|
|
13
|
+
* ```
|
|
14
|
+
* 0 - 7: standard colors
|
|
15
|
+
* 8 - 15: high intensity colors
|
|
16
|
+
* 16 - 231: 6 × 6 × 6 cube (216 colors)
|
|
17
|
+
* 232 - 255: grayscale from black to white in 24 steps
|
|
18
|
+
* ```
|
|
19
|
+
* @param {number} code in range [0, 255].
|
|
20
|
+
*/
|
|
21
|
+
ansi256: (code: number) => this;
|
|
22
|
+
/**
|
|
23
|
+
* Alias for bgAnsi256.
|
|
24
|
+
* @param {number} code in range [0, 255].
|
|
25
|
+
*/
|
|
26
|
+
bg: (code: number) => this;
|
|
27
|
+
/**
|
|
28
|
+
* Set [256-color ANSI code](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) for background color.
|
|
29
|
+
*
|
|
30
|
+
* Code ranges:
|
|
31
|
+
* ```
|
|
32
|
+
* 0 - 7: standard colors
|
|
33
|
+
* 8 - 15: high intensity colors
|
|
34
|
+
* 16 - 231: 6 × 6 × 6 cube (216 colors)
|
|
35
|
+
* 232 - 255: grayscale from black to white in 24 steps
|
|
36
|
+
* ```
|
|
37
|
+
* @param {number} code in range [0, 255].
|
|
38
|
+
*/
|
|
39
|
+
bgAnsi256: (code: number) => this;
|
|
40
|
+
readonly bgBlack: this;
|
|
41
|
+
readonly bgBlackBright: this;
|
|
42
|
+
readonly bgBlue: this;
|
|
43
|
+
readonly bgBlueBright: this;
|
|
44
|
+
readonly bgCyan: this;
|
|
45
|
+
readonly bgCyanBright: this;
|
|
46
|
+
readonly bgGray: this;
|
|
47
|
+
readonly bgGreen: this;
|
|
48
|
+
readonly bgGreenBright: this;
|
|
49
|
+
readonly bgGrey: this;
|
|
50
|
+
/**
|
|
51
|
+
* Set HEX value for background color.
|
|
52
|
+
* @param {string} hex
|
|
53
|
+
*/
|
|
54
|
+
bgHex: (color: ColorValueHex) => this;
|
|
55
|
+
readonly bgMagenta: this;
|
|
56
|
+
readonly bgMagentaBright: this;
|
|
57
|
+
readonly bgRed: this;
|
|
58
|
+
readonly bgRedBright: this;
|
|
59
|
+
/**
|
|
60
|
+
* Set RGB values for background color.
|
|
61
|
+
* @param {number} red The red value, in range [0, 255].
|
|
62
|
+
* @param {number} green The green value, in range [0, 255].
|
|
63
|
+
* @param {number} blue The blue value, in range [0, 255].
|
|
64
|
+
*/
|
|
65
|
+
bgRgb: (red: number, green: number, blue: number) => this;
|
|
66
|
+
readonly bgWhite: this;
|
|
67
|
+
readonly bgWhiteBright: this;
|
|
68
|
+
readonly bgYellow: this;
|
|
69
|
+
readonly bgYellowBright: this;
|
|
70
|
+
readonly black: this;
|
|
71
|
+
readonly blackBright: this;
|
|
72
|
+
readonly blue: this;
|
|
73
|
+
readonly blueBright: this;
|
|
74
|
+
/** <b>Bold</b> style (high intensity). */
|
|
75
|
+
readonly bold: this;
|
|
76
|
+
/** The ANSI escape sequences for ending the current style. */
|
|
77
|
+
readonly close: string;
|
|
78
|
+
readonly cyan: this;
|
|
79
|
+
readonly cyanBright: this;
|
|
80
|
+
/** Faint style (low intensity or dim). */
|
|
81
|
+
readonly dim: this;
|
|
82
|
+
/**
|
|
83
|
+
* Alias for ansi256.
|
|
84
|
+
* @param {number} code in range [0, 255].
|
|
85
|
+
*/
|
|
86
|
+
fg: (code: number) => this;
|
|
87
|
+
readonly gray: this;
|
|
88
|
+
readonly green: this;
|
|
89
|
+
readonly greenBright: this;
|
|
90
|
+
readonly grey: this;
|
|
91
|
+
/**
|
|
92
|
+
* Set HEX value for foreground color.
|
|
93
|
+
* @param {string} hex
|
|
94
|
+
*/
|
|
95
|
+
hex: (color: ColorValueHex) => this;
|
|
96
|
+
/** Print the invisible text. */
|
|
97
|
+
readonly hidden: this;
|
|
98
|
+
/** Invert background and foreground colors. */
|
|
99
|
+
readonly inverse: this;
|
|
100
|
+
/** <i>Italic</i> style. (Not widely supported) */
|
|
101
|
+
readonly italic: this;
|
|
102
|
+
readonly magenta: this;
|
|
103
|
+
readonly magentaBright: this;
|
|
104
|
+
/** The ANSI escape sequences for starting the current style. */
|
|
105
|
+
readonly open: string;
|
|
106
|
+
/** O̅v̅e̅r̅l̅i̅n̅e̅ style. (Not widely supported) */
|
|
107
|
+
readonly overline: this;
|
|
108
|
+
readonly red: this;
|
|
109
|
+
readonly redBright: this;
|
|
110
|
+
/** Reset the current style. */
|
|
111
|
+
readonly reset: this;
|
|
112
|
+
/**
|
|
113
|
+
* Set RGB values for foreground color.
|
|
114
|
+
* @param {number} red The red value, in range [0, 255].
|
|
115
|
+
* @param {number} green The green value, in range [0, 255].
|
|
116
|
+
* @param {number} blue The blue value, in range [0, 255].
|
|
117
|
+
*/
|
|
118
|
+
rgb: (red: number, green: number, blue: number) => this;
|
|
119
|
+
/** S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style. (Not widely supported) The alias for `strikethrough`. */
|
|
120
|
+
readonly strike: this;
|
|
121
|
+
/** S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style. (Not widely supported) */
|
|
122
|
+
readonly strikethrough: this;
|
|
123
|
+
/**
|
|
124
|
+
* Remove ANSI styling codes.
|
|
125
|
+
* @param {string} str
|
|
126
|
+
* @returns {string}
|
|
127
|
+
*/
|
|
128
|
+
strip: (string: string) => string;
|
|
129
|
+
/** U̲n̲d̲e̲r̲l̲i̲n̲e̲ style. (Not widely supported) */
|
|
130
|
+
readonly underline: this;
|
|
131
|
+
/** Print visible text without ANSI styling. */
|
|
132
|
+
readonly visible: this;
|
|
133
|
+
readonly white: this;
|
|
134
|
+
readonly whiteBright: this;
|
|
135
|
+
readonly yellow: this;
|
|
136
|
+
readonly yellowBright: this;
|
|
137
|
+
}
|
|
138
|
+
export type ColorData = {
|
|
139
|
+
close: string;
|
|
140
|
+
open: string;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Base ANSI Styles
|
|
144
|
+
*/
|
|
145
|
+
export type AnsiStyles = "bold" | "dim" | "hidden" | "inverse" | "italic" | "overline" | "reset" | "strike" | "strikethrough" | "underline" | "visible";
|
|
146
|
+
/**
|
|
147
|
+
* Base ANSI Colors
|
|
148
|
+
*/
|
|
149
|
+
export 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";
|
|
150
|
+
export 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";
|
|
151
|
+
export type CssColorCodes = {
|
|
152
|
+
[key in CssColorName]: [number, number, number];
|
|
153
|
+
};
|
|
154
|
+
export type StopInput = {
|
|
155
|
+
color?: ColorValueHex | CssColorName | RGB | [number, number, number];
|
|
156
|
+
colorLess?: boolean;
|
|
157
|
+
position: number;
|
|
158
|
+
};
|
|
159
|
+
export type StopOutput = {
|
|
160
|
+
color: [number, number, number] | undefined;
|
|
161
|
+
colorLess?: boolean;
|
|
162
|
+
position: number;
|
|
163
|
+
};
|
|
164
|
+
export type RGB = {
|
|
165
|
+
b: number;
|
|
166
|
+
g: number;
|
|
167
|
+
r: number;
|
|
168
|
+
};
|
|
169
|
+
export type HSVA = {
|
|
170
|
+
a?: number;
|
|
171
|
+
h: number;
|
|
172
|
+
s: number;
|
|
173
|
+
v: number;
|
|
174
|
+
};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
export type ColorValueHex = `#${string}`;
|
|
2
|
+
export interface ColorizeType {
|
|
3
|
+
/**
|
|
4
|
+
* Return styled string.
|
|
5
|
+
* @param {string | TemplateStringsArray} string
|
|
6
|
+
*/
|
|
7
|
+
(string: number | string): string;
|
|
8
|
+
(string: TemplateStringsArray, ...parameters: string[]): string;
|
|
9
|
+
/**
|
|
10
|
+
* Set [256-color ANSI code](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) for foreground color.
|
|
11
|
+
*
|
|
12
|
+
* Code ranges:
|
|
13
|
+
* ```
|
|
14
|
+
* 0 - 7: standard colors
|
|
15
|
+
* 8 - 15: high intensity colors
|
|
16
|
+
* 16 - 231: 6 × 6 × 6 cube (216 colors)
|
|
17
|
+
* 232 - 255: grayscale from black to white in 24 steps
|
|
18
|
+
* ```
|
|
19
|
+
* @param {number} code in range [0, 255].
|
|
20
|
+
*/
|
|
21
|
+
ansi256: (code: number) => this;
|
|
22
|
+
/**
|
|
23
|
+
* Alias for bgAnsi256.
|
|
24
|
+
* @param {number} code in range [0, 255].
|
|
25
|
+
*/
|
|
26
|
+
bg: (code: number) => this;
|
|
27
|
+
/**
|
|
28
|
+
* Set [256-color ANSI code](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) for background color.
|
|
29
|
+
*
|
|
30
|
+
* Code ranges:
|
|
31
|
+
* ```
|
|
32
|
+
* 0 - 7: standard colors
|
|
33
|
+
* 8 - 15: high intensity colors
|
|
34
|
+
* 16 - 231: 6 × 6 × 6 cube (216 colors)
|
|
35
|
+
* 232 - 255: grayscale from black to white in 24 steps
|
|
36
|
+
* ```
|
|
37
|
+
* @param {number} code in range [0, 255].
|
|
38
|
+
*/
|
|
39
|
+
bgAnsi256: (code: number) => this;
|
|
40
|
+
readonly bgBlack: this;
|
|
41
|
+
readonly bgBlackBright: this;
|
|
42
|
+
readonly bgBlue: this;
|
|
43
|
+
readonly bgBlueBright: this;
|
|
44
|
+
readonly bgCyan: this;
|
|
45
|
+
readonly bgCyanBright: this;
|
|
46
|
+
readonly bgGray: this;
|
|
47
|
+
readonly bgGreen: this;
|
|
48
|
+
readonly bgGreenBright: this;
|
|
49
|
+
readonly bgGrey: this;
|
|
50
|
+
/**
|
|
51
|
+
* Set HEX value for background color.
|
|
52
|
+
* @param {string} hex
|
|
53
|
+
*/
|
|
54
|
+
bgHex: (color: ColorValueHex) => this;
|
|
55
|
+
readonly bgMagenta: this;
|
|
56
|
+
readonly bgMagentaBright: this;
|
|
57
|
+
readonly bgRed: this;
|
|
58
|
+
readonly bgRedBright: this;
|
|
59
|
+
/**
|
|
60
|
+
* Set RGB values for background color.
|
|
61
|
+
* @param {number} red The red value, in range [0, 255].
|
|
62
|
+
* @param {number} green The green value, in range [0, 255].
|
|
63
|
+
* @param {number} blue The blue value, in range [0, 255].
|
|
64
|
+
*/
|
|
65
|
+
bgRgb: (red: number, green: number, blue: number) => this;
|
|
66
|
+
readonly bgWhite: this;
|
|
67
|
+
readonly bgWhiteBright: this;
|
|
68
|
+
readonly bgYellow: this;
|
|
69
|
+
readonly bgYellowBright: this;
|
|
70
|
+
readonly black: this;
|
|
71
|
+
readonly blackBright: this;
|
|
72
|
+
readonly blue: this;
|
|
73
|
+
readonly blueBright: this;
|
|
74
|
+
/** <b>Bold</b> style (high intensity). */
|
|
75
|
+
readonly bold: this;
|
|
76
|
+
/** The ANSI escape sequences for ending the current style. */
|
|
77
|
+
readonly close: string;
|
|
78
|
+
readonly cyan: this;
|
|
79
|
+
readonly cyanBright: this;
|
|
80
|
+
/** Faint style (low intensity or dim). */
|
|
81
|
+
readonly dim: this;
|
|
82
|
+
/**
|
|
83
|
+
* Alias for ansi256.
|
|
84
|
+
* @param {number} code in range [0, 255].
|
|
85
|
+
*/
|
|
86
|
+
fg: (code: number) => this;
|
|
87
|
+
readonly gray: this;
|
|
88
|
+
readonly green: this;
|
|
89
|
+
readonly greenBright: this;
|
|
90
|
+
readonly grey: this;
|
|
91
|
+
/**
|
|
92
|
+
* Set HEX value for foreground color.
|
|
93
|
+
* @param {string} hex
|
|
94
|
+
*/
|
|
95
|
+
hex: (color: ColorValueHex) => this;
|
|
96
|
+
/** Print the invisible text. */
|
|
97
|
+
readonly hidden: this;
|
|
98
|
+
/** Invert background and foreground colors. */
|
|
99
|
+
readonly inverse: this;
|
|
100
|
+
/** <i>Italic</i> style. (Not widely supported) */
|
|
101
|
+
readonly italic: this;
|
|
102
|
+
readonly magenta: this;
|
|
103
|
+
readonly magentaBright: this;
|
|
104
|
+
/** The ANSI escape sequences for starting the current style. */
|
|
105
|
+
readonly open: string;
|
|
106
|
+
/** O̅v̅e̅r̅l̅i̅n̅e̅ style. (Not widely supported) */
|
|
107
|
+
readonly overline: this;
|
|
108
|
+
readonly red: this;
|
|
109
|
+
readonly redBright: this;
|
|
110
|
+
/** Reset the current style. */
|
|
111
|
+
readonly reset: this;
|
|
112
|
+
/**
|
|
113
|
+
* Set RGB values for foreground color.
|
|
114
|
+
* @param {number} red The red value, in range [0, 255].
|
|
115
|
+
* @param {number} green The green value, in range [0, 255].
|
|
116
|
+
* @param {number} blue The blue value, in range [0, 255].
|
|
117
|
+
*/
|
|
118
|
+
rgb: (red: number, green: number, blue: number) => this;
|
|
119
|
+
/** S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style. (Not widely supported) The alias for `strikethrough`. */
|
|
120
|
+
readonly strike: this;
|
|
121
|
+
/** S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style. (Not widely supported) */
|
|
122
|
+
readonly strikethrough: this;
|
|
123
|
+
/**
|
|
124
|
+
* Remove ANSI styling codes.
|
|
125
|
+
* @param {string} str
|
|
126
|
+
* @returns {string}
|
|
127
|
+
*/
|
|
128
|
+
strip: (string: string) => string;
|
|
129
|
+
/** U̲n̲d̲e̲r̲l̲i̲n̲e̲ style. (Not widely supported) */
|
|
130
|
+
readonly underline: this;
|
|
131
|
+
/** Print visible text without ANSI styling. */
|
|
132
|
+
readonly visible: this;
|
|
133
|
+
readonly white: this;
|
|
134
|
+
readonly whiteBright: this;
|
|
135
|
+
readonly yellow: this;
|
|
136
|
+
readonly yellowBright: this;
|
|
137
|
+
}
|
|
138
|
+
export type ColorData = {
|
|
139
|
+
close: string;
|
|
140
|
+
open: string;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Base ANSI Styles
|
|
144
|
+
*/
|
|
145
|
+
export type AnsiStyles = "bold" | "dim" | "hidden" | "inverse" | "italic" | "overline" | "reset" | "strike" | "strikethrough" | "underline" | "visible";
|
|
146
|
+
/**
|
|
147
|
+
* Base ANSI Colors
|
|
148
|
+
*/
|
|
149
|
+
export 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";
|
|
150
|
+
export 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";
|
|
151
|
+
export type CssColorCodes = {
|
|
152
|
+
[key in CssColorName]: [number, number, number];
|
|
153
|
+
};
|
|
154
|
+
export type StopInput = {
|
|
155
|
+
color?: ColorValueHex | CssColorName | RGB | [number, number, number];
|
|
156
|
+
colorLess?: boolean;
|
|
157
|
+
position: number;
|
|
158
|
+
};
|
|
159
|
+
export type StopOutput = {
|
|
160
|
+
color: [number, number, number] | undefined;
|
|
161
|
+
colorLess?: boolean;
|
|
162
|
+
position: number;
|
|
163
|
+
};
|
|
164
|
+
export type RGB = {
|
|
165
|
+
b: number;
|
|
166
|
+
g: number;
|
|
167
|
+
r: number;
|
|
168
|
+
};
|
|
169
|
+
export type HSVA = {
|
|
170
|
+
a?: number;
|
|
171
|
+
h: number;
|
|
172
|
+
s: number;
|
|
173
|
+
v: number;
|
|
174
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/webdiscus/ansis/blob/master/src/utils.js
|
|
3
|
+
*
|
|
4
|
+
* ISC License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2023, webdiscus
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Clamp a number within the inclusive range specified by min and max.
|
|
10
|
+
* @note: The ternary operator is a tick quicker than Math.min(Math.max(num, min), max).
|
|
11
|
+
*/
|
|
12
|
+
export declare const clamp: (number_: number, min: number, max: number) => number;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/webdiscus/ansis/blob/master/src/utils.js
|
|
3
|
+
*
|
|
4
|
+
* ISC License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2023, webdiscus
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Clamp a number within the inclusive range specified by min and max.
|
|
10
|
+
* @note: The ternary operator is a tick quicker than Math.min(Math.max(num, min), max).
|
|
11
|
+
*/
|
|
12
|
+
export declare const clamp: (number_: number, min: number, max: number) => number;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/webdiscus/ansis/blob/master/src/utils.js
|
|
3
|
+
*
|
|
4
|
+
* ISC License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2023, webdiscus
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Clamp a number within the inclusive range specified by min and max.
|
|
10
|
+
* @note: The ternary operator is a tick quicker than Math.min(Math.max(num, min), max).
|
|
11
|
+
*/
|
|
12
|
+
export declare const clamp: (number_: number, min: number, max: number) => number;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/webdiscus/ansis/blob/master/src/utils.js
|
|
3
|
+
*
|
|
4
|
+
* ISC License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2023, webdiscus
|
|
7
|
+
*/
|
|
8
|
+
import type { ColorValueHex } from "../types.d.cts";
|
|
9
|
+
/**
|
|
10
|
+
* Convert hex color string to RGB values.
|
|
11
|
+
*
|
|
12
|
+
* A hexadecimal color code can be 3 or 6 digits with an optional "#" prefix.
|
|
13
|
+
*
|
|
14
|
+
* The 3 digits specifies an RGB doublet data as a fully opaque color.
|
|
15
|
+
* For example, "#123" specifies the color that is represented by "#112233".
|
|
16
|
+
*
|
|
17
|
+
* The 6 digits specifies a fully opaque color.
|
|
18
|
+
* For example, "#112233".
|
|
19
|
+
* @param {string} hex A string that contains the hexadecimal RGB color representation.
|
|
20
|
+
* @returns {[number, number, number]} The red, green, blue values in range [0, 255] .
|
|
21
|
+
*/
|
|
22
|
+
export declare const convertHexToRgb: (hex: ColorValueHex | string) => [number, number, number];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/webdiscus/ansis/blob/master/src/utils.js
|
|
3
|
+
*
|
|
4
|
+
* ISC License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2023, webdiscus
|
|
7
|
+
*/
|
|
8
|
+
import type { ColorValueHex } from "../types.d.mts";
|
|
9
|
+
/**
|
|
10
|
+
* Convert hex color string to RGB values.
|
|
11
|
+
*
|
|
12
|
+
* A hexadecimal color code can be 3 or 6 digits with an optional "#" prefix.
|
|
13
|
+
*
|
|
14
|
+
* The 3 digits specifies an RGB doublet data as a fully opaque color.
|
|
15
|
+
* For example, "#123" specifies the color that is represented by "#112233".
|
|
16
|
+
*
|
|
17
|
+
* The 6 digits specifies a fully opaque color.
|
|
18
|
+
* For example, "#112233".
|
|
19
|
+
* @param {string} hex A string that contains the hexadecimal RGB color representation.
|
|
20
|
+
* @returns {[number, number, number]} The red, green, blue values in range [0, 255] .
|
|
21
|
+
*/
|
|
22
|
+
export declare const convertHexToRgb: (hex: ColorValueHex | string) => [number, number, number];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/webdiscus/ansis/blob/master/src/utils.js
|
|
3
|
+
*
|
|
4
|
+
* ISC License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2023, webdiscus
|
|
7
|
+
*/
|
|
8
|
+
import type { ColorValueHex } from "../types.d.ts";
|
|
9
|
+
/**
|
|
10
|
+
* Convert hex color string to RGB values.
|
|
11
|
+
*
|
|
12
|
+
* A hexadecimal color code can be 3 or 6 digits with an optional "#" prefix.
|
|
13
|
+
*
|
|
14
|
+
* The 3 digits specifies an RGB doublet data as a fully opaque color.
|
|
15
|
+
* For example, "#123" specifies the color that is represented by "#112233".
|
|
16
|
+
*
|
|
17
|
+
* The 6 digits specifies a fully opaque color.
|
|
18
|
+
* For example, "#112233".
|
|
19
|
+
* @param {string} hex A string that contains the hexadecimal RGB color representation.
|
|
20
|
+
* @returns {[number, number, number]} The red, green, blue values in range [0, 255] .
|
|
21
|
+
*/
|
|
22
|
+
export declare const convertHexToRgb: (hex: ColorValueHex | string) => [number, number, number];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copy of https://github.com/Qix-/color-convert/blob/master/conversions.js#L551
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.com>.
|
|
7
|
+
* Copyright (c) 2016-2021 Josh Junon <josh@junon.me>.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Convert RGB values to approximate code of ANSI 256 colors.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export declare const rgbToAnsi256: (r: number, g: number, b: number) => number;
|
|
14
|
+
/**
|
|
15
|
+
* Convert ANSI 256 color code to approximate code of ANSI 16 colors.
|
|
16
|
+
*/
|
|
17
|
+
export declare const ansi256To16: (code: number) => number;
|
|
18
|
+
export declare const rgbToAnsi16: (r: number, g: number, b: number) => number;
|