ansi-styles 6.2.1 → 6.2.3
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/index.d.ts +12 -12
- package/index.js +3 -3
- package/package.json +4 -4
package/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export
|
1
|
+
export type CSPair = { // eslint-disable-line @typescript-eslint/naming-convention
|
2
2
|
/**
|
3
3
|
The ANSI terminal control sequence for starting this style.
|
4
4
|
*/
|
@@ -8,9 +8,9 @@ export interface CSPair { // eslint-disable-line @typescript-eslint/naming-conve
|
|
8
8
|
The ANSI terminal control sequence for ending this style.
|
9
9
|
*/
|
10
10
|
readonly close: string;
|
11
|
-
}
|
11
|
+
};
|
12
12
|
|
13
|
-
export
|
13
|
+
export type ColorBase = {
|
14
14
|
/**
|
15
15
|
The ANSI terminal control sequence for ending this color.
|
16
16
|
*/
|
@@ -21,9 +21,9 @@ export interface ColorBase {
|
|
21
21
|
ansi256(code: number): string;
|
22
22
|
|
23
23
|
ansi16m(red: number, green: number, blue: number): string;
|
24
|
-
}
|
24
|
+
};
|
25
25
|
|
26
|
-
export
|
26
|
+
export type Modifier = {
|
27
27
|
/**
|
28
28
|
Resets the current color chain.
|
29
29
|
*/
|
@@ -70,9 +70,9 @@ export interface Modifier {
|
|
70
70
|
Puts a horizontal line through the center of the text. (Not widely supported)
|
71
71
|
*/
|
72
72
|
readonly strikethrough: CSPair;
|
73
|
-
}
|
73
|
+
};
|
74
74
|
|
75
|
-
export
|
75
|
+
export type ForegroundColor = {
|
76
76
|
readonly black: CSPair;
|
77
77
|
readonly red: CSPair;
|
78
78
|
readonly green: CSPair;
|
@@ -100,9 +100,9 @@ export interface ForegroundColor {
|
|
100
100
|
readonly cyanBright: CSPair;
|
101
101
|
readonly magentaBright: CSPair;
|
102
102
|
readonly whiteBright: CSPair;
|
103
|
-
}
|
103
|
+
};
|
104
104
|
|
105
|
-
export
|
105
|
+
export type BackgroundColor = {
|
106
106
|
readonly bgBlack: CSPair;
|
107
107
|
readonly bgRed: CSPair;
|
108
108
|
readonly bgGreen: CSPair;
|
@@ -130,9 +130,9 @@ export interface BackgroundColor {
|
|
130
130
|
readonly bgCyanBright: CSPair;
|
131
131
|
readonly bgMagentaBright: CSPair;
|
132
132
|
readonly bgWhiteBright: CSPair;
|
133
|
-
}
|
133
|
+
};
|
134
134
|
|
135
|
-
export
|
135
|
+
export type ConvertColor = {
|
136
136
|
/**
|
137
137
|
Convert from the RGB color space to the ANSI 256 color space.
|
138
138
|
|
@@ -178,7 +178,7 @@ export interface ConvertColor {
|
|
178
178
|
@param hex - A hexadecimal string containing RGB data.
|
179
179
|
*/
|
180
180
|
hexToAnsi(hex: string): number;
|
181
|
-
}
|
181
|
+
};
|
182
182
|
|
183
183
|
/**
|
184
184
|
Basic modifier names.
|
package/index.js
CHANGED
@@ -109,7 +109,7 @@ function assembleStyles() {
|
|
109
109
|
// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
|
110
110
|
Object.defineProperties(styles, {
|
111
111
|
rgbToAnsi256: {
|
112
|
-
value
|
112
|
+
value(red, green, blue) {
|
113
113
|
// We use the extended greyscale palette here, with the exception of
|
114
114
|
// black and white. normal palette only has 4 greyscale shades.
|
115
115
|
if (red === green && green === blue) {
|
@@ -132,7 +132,7 @@ function assembleStyles() {
|
|
132
132
|
enumerable: false,
|
133
133
|
},
|
134
134
|
hexToRgb: {
|
135
|
-
value
|
135
|
+
value(hex) {
|
136
136
|
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
137
137
|
if (!matches) {
|
138
138
|
return [0, 0, 0];
|
@@ -161,7 +161,7 @@ function assembleStyles() {
|
|
161
161
|
enumerable: false,
|
162
162
|
},
|
163
163
|
ansi256ToAnsi: {
|
164
|
-
value
|
164
|
+
value(code) {
|
165
165
|
if (code < 8) {
|
166
166
|
return 30 + code;
|
167
167
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "ansi-styles",
|
3
|
-
"version": "6.2.
|
3
|
+
"version": "6.2.3",
|
4
4
|
"description": "ANSI escape codes for styling strings in the terminal",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": "chalk/ansi-styles",
|
@@ -46,9 +46,9 @@
|
|
46
46
|
"text"
|
47
47
|
],
|
48
48
|
"devDependencies": {
|
49
|
-
"ava": "^
|
49
|
+
"ava": "^6.1.3",
|
50
50
|
"svg-term-cli": "^2.1.1",
|
51
|
-
"tsd": "^0.
|
52
|
-
"xo": "^0.
|
51
|
+
"tsd": "^0.31.1",
|
52
|
+
"xo": "^0.58.0"
|
53
53
|
}
|
54
54
|
}
|