@breadc/color 0.9.7 → 1.0.0-beta.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 +1 -1
- package/dist/index.d.mts +8 -7
- package/dist/index.mjs +48 -63
- package/package.json +5 -12
- package/dist/index.cjs +0 -165
- package/dist/index.d.cts +0 -63
- package/dist/index.d.ts +0 -63
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@breadc/color) [](https://github.com/yjl9903/Breadc/actions/workflows/ci.yml)
|
|
4
4
|
|
|
5
|
-

|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
//#region src/color.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Detect how much colors the current terminal supports
|
|
3
4
|
*/
|
|
4
5
|
declare const enum SupportLevel {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
none = 0,
|
|
7
|
+
ansi = 1,
|
|
8
|
+
ansi256 = 2
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* Config whether enable color output
|
|
11
12
|
*/
|
|
12
13
|
declare const options: {
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
supportLevel: SupportLevel;
|
|
15
16
|
};
|
|
16
17
|
declare function kolorist(start: number | string, end: number | string, level?: SupportLevel): (str: string | number) => string;
|
|
17
18
|
declare function combine(...fns: ReturnType<typeof kolorist>[]): (str: string | number) => string | number;
|
|
@@ -59,5 +60,5 @@ declare const bgLightGray: (str: string | number) => string;
|
|
|
59
60
|
declare const ansi256: (n: number) => (str: string | number) => string;
|
|
60
61
|
declare const ansi256Bg: (n: number) => (str: string | number) => string;
|
|
61
62
|
declare function link(text: string, url: string): string;
|
|
62
|
-
|
|
63
|
-
export { SupportLevel, ansi256, ansi256Bg, bgBlack, bgBlue, bgCyan, bgGray, bgGreen, bgLightBlue, bgLightCyan, bgLightGray, bgLightGreen, bgLightMagenta, bgLightRed, bgLightYellow, bgMagenta, bgRed, bgWhite, bgYellow, black, blue, bold, combine, cyan, dim, gray, green, hidden, inverse, italic, lightBlue, lightCyan, lightGray, lightGreen, lightMagenta, lightRed, lightYellow, link, magenta, options, red, reset, strikethrough, stripColors, underline, white, yellow };
|
|
63
|
+
//#endregion
|
|
64
|
+
export { SupportLevel, ansi256, ansi256Bg, bgBlack, bgBlue, bgCyan, bgGray, bgGreen, bgLightBlue, bgLightCyan, bgLightGray, bgLightGreen, bgLightMagenta, bgLightRed, bgLightYellow, bgMagenta, bgRed, bgWhite, bgYellow, black, blue, bold, combine, cyan, dim, gray, green, hidden, inverse, italic, lightBlue, lightCyan, lightGray, lightGreen, lightMagenta, lightRed, lightYellow, link, magenta, options, red, reset, strikethrough, stripColors, underline, white, yellow };
|
package/dist/index.mjs
CHANGED
|
@@ -1,69 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//#region src/color.ts
|
|
2
|
+
/**
|
|
3
|
+
* Detect how much colors the current terminal supports
|
|
4
|
+
*/
|
|
5
|
+
let SupportLevel = /* @__PURE__ */ function(SupportLevel) {
|
|
6
|
+
SupportLevel[SupportLevel["none"] = 0] = "none";
|
|
7
|
+
SupportLevel[SupportLevel["ansi"] = 1] = "ansi";
|
|
8
|
+
SupportLevel[SupportLevel["ansi256"] = 2] = "ansi256";
|
|
9
|
+
return SupportLevel;
|
|
10
|
+
}({});
|
|
11
|
+
/**
|
|
12
|
+
* Config whether enable color output
|
|
13
|
+
*/
|
|
7
14
|
const options = {
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
enabled: true,
|
|
16
|
+
supportLevel: SupportLevel.none
|
|
10
17
|
};
|
|
11
|
-
const globalVar =
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
typeof self !== "undefined" ? (
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
self
|
|
16
|
-
) : (
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
typeof window !== "undefined" ? (
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
window
|
|
21
|
-
) : typeof global !== "undefined" ? global : {}
|
|
22
|
-
)
|
|
23
|
-
);
|
|
18
|
+
const globalVar = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
|
24
19
|
if (globalVar.process && globalVar.process.env && globalVar.process.stdout) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
].some((vendor) => vendor in globalVar.process.env)) {
|
|
41
|
-
options.enabled = true;
|
|
42
|
-
} else {
|
|
43
|
-
options.enabled = process.stdout.isTTY;
|
|
44
|
-
}
|
|
45
|
-
if (options.enabled) {
|
|
46
|
-
options.supportLevel = TERM && TERM.endsWith("-256color") ? 2 /* ansi256 */ : 1 /* ansi */;
|
|
47
|
-
}
|
|
20
|
+
const { FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = globalVar.process.env;
|
|
21
|
+
if (NODE_DISABLE_COLORS || NO_COLOR || FORCE_COLOR === "0") options.enabled = false;
|
|
22
|
+
else if (FORCE_COLOR === "1" || FORCE_COLOR === "2" || FORCE_COLOR === "3") options.enabled = true;
|
|
23
|
+
else if (TERM === "dumb") options.enabled = false;
|
|
24
|
+
else if ("CI" in globalVar.process.env && [
|
|
25
|
+
"TRAVIS",
|
|
26
|
+
"CIRCLECI",
|
|
27
|
+
"APPVEYOR",
|
|
28
|
+
"GITLAB_CI",
|
|
29
|
+
"GITHUB_ACTIONS",
|
|
30
|
+
"BUILDKITE",
|
|
31
|
+
"DRONE"
|
|
32
|
+
].some((vendor) => vendor in globalVar.process.env)) options.enabled = true;
|
|
33
|
+
else options.enabled = process.stdout.isTTY;
|
|
34
|
+
if (options.enabled) options.supportLevel = TERM && TERM.endsWith("-256color") ? SupportLevel.ansi256 : SupportLevel.ansi;
|
|
48
35
|
}
|
|
49
|
-
function kolorist(start, end, level =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
36
|
+
function kolorist(start, end, level = SupportLevel.ansi) {
|
|
37
|
+
const open = `\x1b[${start}m`;
|
|
38
|
+
const close = `\x1b[${end}m`;
|
|
39
|
+
const regex = new RegExp(`\\x1b\\[${end}m`, "g");
|
|
40
|
+
return (str) => {
|
|
41
|
+
return options.enabled && options.supportLevel >= level ? open + ("" + str).replace(regex, open) + close : "" + str;
|
|
42
|
+
};
|
|
56
43
|
}
|
|
57
44
|
function combine(...fns) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return str;
|
|
63
|
-
};
|
|
45
|
+
return (str) => {
|
|
46
|
+
for (const fn of fns) str = fn(str);
|
|
47
|
+
return str;
|
|
48
|
+
};
|
|
64
49
|
}
|
|
65
50
|
function stripColors(str) {
|
|
66
|
-
|
|
51
|
+
return ("" + str).replace(/\x1b\[[0-9;]+m/g, "").replace(/\x1b\]8;;.*?\x07(.*?)\x1b\]8;;\x07/g, (_, group) => group);
|
|
67
52
|
}
|
|
68
53
|
const reset = kolorist(0, 0);
|
|
69
54
|
const bold = kolorist(1, 22);
|
|
@@ -105,13 +90,13 @@ const bgLightBlue = kolorist(104, 49);
|
|
|
105
90
|
const bgLightMagenta = kolorist(105, 49);
|
|
106
91
|
const bgLightCyan = kolorist(106, 49);
|
|
107
92
|
const bgLightGray = kolorist(47, 49);
|
|
108
|
-
const ansi256 = (n) => kolorist("38;5;" + n, 0,
|
|
109
|
-
const ansi256Bg = (n) => kolorist("48;5;" + n, 0,
|
|
93
|
+
const ansi256 = (n) => kolorist("38;5;" + n, 0, SupportLevel.ansi256);
|
|
94
|
+
const ansi256Bg = (n) => kolorist("48;5;" + n, 0, SupportLevel.ansi256);
|
|
110
95
|
const OSC = "\x1B]";
|
|
111
96
|
const BEL = "\x07";
|
|
112
|
-
const SEP = ";";
|
|
113
97
|
function link(text, url) {
|
|
114
|
-
|
|
98
|
+
return options.enabled ? OSC + "8;;" + url + BEL + text + OSC + "8;;\x07" : `${text} (\u200B${url}\u200B)`;
|
|
115
99
|
}
|
|
116
100
|
|
|
117
|
-
|
|
101
|
+
//#endregion
|
|
102
|
+
export { SupportLevel, ansi256, ansi256Bg, bgBlack, bgBlue, bgCyan, bgGray, bgGreen, bgLightBlue, bgLightCyan, bgLightGray, bgLightGreen, bgLightMagenta, bgLightRed, bgLightYellow, bgMagenta, bgRed, bgWhite, bgYellow, black, blue, bold, combine, cyan, dim, gray, green, hidden, inverse, italic, lightBlue, lightCyan, lightGray, lightGreen, lightMagenta, lightRed, lightYellow, link, magenta, options, red, reset, strikethrough, stripColors, underline, white, yellow };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breadc/color",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
4
|
"description": "Terminal color for Breadc",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"breadc",
|
|
@@ -23,24 +23,17 @@
|
|
|
23
23
|
"type": "module",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
-
"
|
|
27
|
-
"import": "./dist/index.mjs"
|
|
28
|
-
"types": "./dist/index.d.ts"
|
|
26
|
+
"types": "./dist/index.d.mts",
|
|
27
|
+
"import": "./dist/index.mjs"
|
|
29
28
|
}
|
|
30
29
|
},
|
|
31
|
-
"main": "dist/index.cjs",
|
|
32
30
|
"module": "dist/index.mjs",
|
|
33
|
-
"types": "dist/index.d.
|
|
31
|
+
"types": "dist/index.d.mts",
|
|
34
32
|
"files": [
|
|
35
33
|
"dist"
|
|
36
34
|
],
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"@types/node": "^20.8.7",
|
|
39
|
-
"vitest": "^0.34.6"
|
|
40
|
-
},
|
|
41
35
|
"scripts": {
|
|
42
|
-
"build": "
|
|
43
|
-
"format": "prettier --write src/**/*.ts test/*.ts",
|
|
36
|
+
"build": "tsdown",
|
|
44
37
|
"test": "vitest",
|
|
45
38
|
"test:ci": "vitest --run",
|
|
46
39
|
"typecheck": "tsc --noEmit"
|
package/dist/index.cjs
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var SupportLevel = /* @__PURE__ */ ((SupportLevel2) => {
|
|
4
|
-
SupportLevel2[SupportLevel2["none"] = 0] = "none";
|
|
5
|
-
SupportLevel2[SupportLevel2["ansi"] = 1] = "ansi";
|
|
6
|
-
SupportLevel2[SupportLevel2["ansi256"] = 2] = "ansi256";
|
|
7
|
-
return SupportLevel2;
|
|
8
|
-
})(SupportLevel || {});
|
|
9
|
-
const options = {
|
|
10
|
-
enabled: true,
|
|
11
|
-
supportLevel: 0 /* none */
|
|
12
|
-
};
|
|
13
|
-
const globalVar = (
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
typeof self !== "undefined" ? (
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
self
|
|
18
|
-
) : (
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
typeof window !== "undefined" ? (
|
|
21
|
-
// @ts-ignore
|
|
22
|
-
window
|
|
23
|
-
) : typeof global !== "undefined" ? global : {}
|
|
24
|
-
)
|
|
25
|
-
);
|
|
26
|
-
if (globalVar.process && globalVar.process.env && globalVar.process.stdout) {
|
|
27
|
-
const { FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = globalVar.process.env;
|
|
28
|
-
if (NODE_DISABLE_COLORS || NO_COLOR || FORCE_COLOR === "0") {
|
|
29
|
-
options.enabled = false;
|
|
30
|
-
} else if (FORCE_COLOR === "1" || FORCE_COLOR === "2" || FORCE_COLOR === "3") {
|
|
31
|
-
options.enabled = true;
|
|
32
|
-
} else if (TERM === "dumb") {
|
|
33
|
-
options.enabled = false;
|
|
34
|
-
} else if ("CI" in globalVar.process.env && [
|
|
35
|
-
"TRAVIS",
|
|
36
|
-
"CIRCLECI",
|
|
37
|
-
"APPVEYOR",
|
|
38
|
-
"GITLAB_CI",
|
|
39
|
-
"GITHUB_ACTIONS",
|
|
40
|
-
"BUILDKITE",
|
|
41
|
-
"DRONE"
|
|
42
|
-
].some((vendor) => vendor in globalVar.process.env)) {
|
|
43
|
-
options.enabled = true;
|
|
44
|
-
} else {
|
|
45
|
-
options.enabled = process.stdout.isTTY;
|
|
46
|
-
}
|
|
47
|
-
if (options.enabled) {
|
|
48
|
-
options.supportLevel = TERM && TERM.endsWith("-256color") ? 2 /* ansi256 */ : 1 /* ansi */;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function kolorist(start, end, level = 1 /* ansi */) {
|
|
52
|
-
const open = `\x1B[${start}m`;
|
|
53
|
-
const close = `\x1B[${end}m`;
|
|
54
|
-
const regex = new RegExp(`\\x1b\\[${end}m`, "g");
|
|
55
|
-
return (str) => {
|
|
56
|
-
return options.enabled && options.supportLevel >= level ? open + ("" + str).replace(regex, open) + close : "" + str;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function combine(...fns) {
|
|
60
|
-
return (str) => {
|
|
61
|
-
for (const fn of fns) {
|
|
62
|
-
str = fn(str);
|
|
63
|
-
}
|
|
64
|
-
return str;
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function stripColors(str) {
|
|
68
|
-
return ("" + str).replace(/\x1b\[[0-9;]+m/g, "").replace(/\x1b\]8;;.*?\x07(.*?)\x1b\]8;;\x07/g, (_, group) => group);
|
|
69
|
-
}
|
|
70
|
-
const reset = kolorist(0, 0);
|
|
71
|
-
const bold = kolorist(1, 22);
|
|
72
|
-
const dim = kolorist(2, 22);
|
|
73
|
-
const italic = kolorist(3, 23);
|
|
74
|
-
const underline = kolorist(4, 24);
|
|
75
|
-
const inverse = kolorist(7, 27);
|
|
76
|
-
const hidden = kolorist(8, 28);
|
|
77
|
-
const strikethrough = kolorist(9, 29);
|
|
78
|
-
const black = kolorist(30, 39);
|
|
79
|
-
const red = kolorist(31, 39);
|
|
80
|
-
const green = kolorist(32, 39);
|
|
81
|
-
const yellow = kolorist(33, 39);
|
|
82
|
-
const blue = kolorist(34, 39);
|
|
83
|
-
const magenta = kolorist(35, 39);
|
|
84
|
-
const cyan = kolorist(36, 39);
|
|
85
|
-
const white = kolorist(97, 39);
|
|
86
|
-
const gray = kolorist(90, 39);
|
|
87
|
-
const lightRed = kolorist(91, 39);
|
|
88
|
-
const lightGreen = kolorist(92, 39);
|
|
89
|
-
const lightYellow = kolorist(93, 39);
|
|
90
|
-
const lightBlue = kolorist(94, 39);
|
|
91
|
-
const lightMagenta = kolorist(95, 39);
|
|
92
|
-
const lightCyan = kolorist(96, 39);
|
|
93
|
-
const lightGray = kolorist(37, 39);
|
|
94
|
-
const bgBlack = kolorist(40, 49);
|
|
95
|
-
const bgRed = kolorist(41, 49);
|
|
96
|
-
const bgGreen = kolorist(42, 49);
|
|
97
|
-
const bgYellow = kolorist(43, 49);
|
|
98
|
-
const bgBlue = kolorist(44, 49);
|
|
99
|
-
const bgMagenta = kolorist(45, 49);
|
|
100
|
-
const bgCyan = kolorist(46, 49);
|
|
101
|
-
const bgWhite = kolorist(107, 49);
|
|
102
|
-
const bgGray = kolorist(100, 49);
|
|
103
|
-
const bgLightRed = kolorist(101, 49);
|
|
104
|
-
const bgLightGreen = kolorist(102, 49);
|
|
105
|
-
const bgLightYellow = kolorist(103, 49);
|
|
106
|
-
const bgLightBlue = kolorist(104, 49);
|
|
107
|
-
const bgLightMagenta = kolorist(105, 49);
|
|
108
|
-
const bgLightCyan = kolorist(106, 49);
|
|
109
|
-
const bgLightGray = kolorist(47, 49);
|
|
110
|
-
const ansi256 = (n) => kolorist("38;5;" + n, 0, 2 /* ansi256 */);
|
|
111
|
-
const ansi256Bg = (n) => kolorist("48;5;" + n, 0, 2 /* ansi256 */);
|
|
112
|
-
const OSC = "\x1B]";
|
|
113
|
-
const BEL = "\x07";
|
|
114
|
-
const SEP = ";";
|
|
115
|
-
function link(text, url) {
|
|
116
|
-
return options.enabled ? OSC + "8" + SEP + SEP + url + BEL + text + OSC + "8" + SEP + SEP + BEL : `${text} (\u200B${url}\u200B)`;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
exports.SupportLevel = SupportLevel;
|
|
120
|
-
exports.ansi256 = ansi256;
|
|
121
|
-
exports.ansi256Bg = ansi256Bg;
|
|
122
|
-
exports.bgBlack = bgBlack;
|
|
123
|
-
exports.bgBlue = bgBlue;
|
|
124
|
-
exports.bgCyan = bgCyan;
|
|
125
|
-
exports.bgGray = bgGray;
|
|
126
|
-
exports.bgGreen = bgGreen;
|
|
127
|
-
exports.bgLightBlue = bgLightBlue;
|
|
128
|
-
exports.bgLightCyan = bgLightCyan;
|
|
129
|
-
exports.bgLightGray = bgLightGray;
|
|
130
|
-
exports.bgLightGreen = bgLightGreen;
|
|
131
|
-
exports.bgLightMagenta = bgLightMagenta;
|
|
132
|
-
exports.bgLightRed = bgLightRed;
|
|
133
|
-
exports.bgLightYellow = bgLightYellow;
|
|
134
|
-
exports.bgMagenta = bgMagenta;
|
|
135
|
-
exports.bgRed = bgRed;
|
|
136
|
-
exports.bgWhite = bgWhite;
|
|
137
|
-
exports.bgYellow = bgYellow;
|
|
138
|
-
exports.black = black;
|
|
139
|
-
exports.blue = blue;
|
|
140
|
-
exports.bold = bold;
|
|
141
|
-
exports.combine = combine;
|
|
142
|
-
exports.cyan = cyan;
|
|
143
|
-
exports.dim = dim;
|
|
144
|
-
exports.gray = gray;
|
|
145
|
-
exports.green = green;
|
|
146
|
-
exports.hidden = hidden;
|
|
147
|
-
exports.inverse = inverse;
|
|
148
|
-
exports.italic = italic;
|
|
149
|
-
exports.lightBlue = lightBlue;
|
|
150
|
-
exports.lightCyan = lightCyan;
|
|
151
|
-
exports.lightGray = lightGray;
|
|
152
|
-
exports.lightGreen = lightGreen;
|
|
153
|
-
exports.lightMagenta = lightMagenta;
|
|
154
|
-
exports.lightRed = lightRed;
|
|
155
|
-
exports.lightYellow = lightYellow;
|
|
156
|
-
exports.link = link;
|
|
157
|
-
exports.magenta = magenta;
|
|
158
|
-
exports.options = options;
|
|
159
|
-
exports.red = red;
|
|
160
|
-
exports.reset = reset;
|
|
161
|
-
exports.strikethrough = strikethrough;
|
|
162
|
-
exports.stripColors = stripColors;
|
|
163
|
-
exports.underline = underline;
|
|
164
|
-
exports.white = white;
|
|
165
|
-
exports.yellow = yellow;
|
package/dist/index.d.cts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Detect how much colors the current terminal supports
|
|
3
|
-
*/
|
|
4
|
-
declare const enum SupportLevel {
|
|
5
|
-
none = 0,
|
|
6
|
-
ansi = 1,
|
|
7
|
-
ansi256 = 2
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Config whether enable color output
|
|
11
|
-
*/
|
|
12
|
-
declare const options: {
|
|
13
|
-
enabled: boolean;
|
|
14
|
-
supportLevel: SupportLevel;
|
|
15
|
-
};
|
|
16
|
-
declare function kolorist(start: number | string, end: number | string, level?: SupportLevel): (str: string | number) => string;
|
|
17
|
-
declare function combine(...fns: ReturnType<typeof kolorist>[]): (str: string | number) => string | number;
|
|
18
|
-
declare function stripColors(str: string | number): string;
|
|
19
|
-
declare const reset: (str: string | number) => string;
|
|
20
|
-
declare const bold: (str: string | number) => string;
|
|
21
|
-
declare const dim: (str: string | number) => string;
|
|
22
|
-
declare const italic: (str: string | number) => string;
|
|
23
|
-
declare const underline: (str: string | number) => string;
|
|
24
|
-
declare const inverse: (str: string | number) => string;
|
|
25
|
-
declare const hidden: (str: string | number) => string;
|
|
26
|
-
declare const strikethrough: (str: string | number) => string;
|
|
27
|
-
declare const black: (str: string | number) => string;
|
|
28
|
-
declare const red: (str: string | number) => string;
|
|
29
|
-
declare const green: (str: string | number) => string;
|
|
30
|
-
declare const yellow: (str: string | number) => string;
|
|
31
|
-
declare const blue: (str: string | number) => string;
|
|
32
|
-
declare const magenta: (str: string | number) => string;
|
|
33
|
-
declare const cyan: (str: string | number) => string;
|
|
34
|
-
declare const white: (str: string | number) => string;
|
|
35
|
-
declare const gray: (str: string | number) => string;
|
|
36
|
-
declare const lightRed: (str: string | number) => string;
|
|
37
|
-
declare const lightGreen: (str: string | number) => string;
|
|
38
|
-
declare const lightYellow: (str: string | number) => string;
|
|
39
|
-
declare const lightBlue: (str: string | number) => string;
|
|
40
|
-
declare const lightMagenta: (str: string | number) => string;
|
|
41
|
-
declare const lightCyan: (str: string | number) => string;
|
|
42
|
-
declare const lightGray: (str: string | number) => string;
|
|
43
|
-
declare const bgBlack: (str: string | number) => string;
|
|
44
|
-
declare const bgRed: (str: string | number) => string;
|
|
45
|
-
declare const bgGreen: (str: string | number) => string;
|
|
46
|
-
declare const bgYellow: (str: string | number) => string;
|
|
47
|
-
declare const bgBlue: (str: string | number) => string;
|
|
48
|
-
declare const bgMagenta: (str: string | number) => string;
|
|
49
|
-
declare const bgCyan: (str: string | number) => string;
|
|
50
|
-
declare const bgWhite: (str: string | number) => string;
|
|
51
|
-
declare const bgGray: (str: string | number) => string;
|
|
52
|
-
declare const bgLightRed: (str: string | number) => string;
|
|
53
|
-
declare const bgLightGreen: (str: string | number) => string;
|
|
54
|
-
declare const bgLightYellow: (str: string | number) => string;
|
|
55
|
-
declare const bgLightBlue: (str: string | number) => string;
|
|
56
|
-
declare const bgLightMagenta: (str: string | number) => string;
|
|
57
|
-
declare const bgLightCyan: (str: string | number) => string;
|
|
58
|
-
declare const bgLightGray: (str: string | number) => string;
|
|
59
|
-
declare const ansi256: (n: number) => (str: string | number) => string;
|
|
60
|
-
declare const ansi256Bg: (n: number) => (str: string | number) => string;
|
|
61
|
-
declare function link(text: string, url: string): string;
|
|
62
|
-
|
|
63
|
-
export { SupportLevel, ansi256, ansi256Bg, bgBlack, bgBlue, bgCyan, bgGray, bgGreen, bgLightBlue, bgLightCyan, bgLightGray, bgLightGreen, bgLightMagenta, bgLightRed, bgLightYellow, bgMagenta, bgRed, bgWhite, bgYellow, black, blue, bold, combine, cyan, dim, gray, green, hidden, inverse, italic, lightBlue, lightCyan, lightGray, lightGreen, lightMagenta, lightRed, lightYellow, link, magenta, options, red, reset, strikethrough, stripColors, underline, white, yellow };
|
package/dist/index.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Detect how much colors the current terminal supports
|
|
3
|
-
*/
|
|
4
|
-
declare const enum SupportLevel {
|
|
5
|
-
none = 0,
|
|
6
|
-
ansi = 1,
|
|
7
|
-
ansi256 = 2
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Config whether enable color output
|
|
11
|
-
*/
|
|
12
|
-
declare const options: {
|
|
13
|
-
enabled: boolean;
|
|
14
|
-
supportLevel: SupportLevel;
|
|
15
|
-
};
|
|
16
|
-
declare function kolorist(start: number | string, end: number | string, level?: SupportLevel): (str: string | number) => string;
|
|
17
|
-
declare function combine(...fns: ReturnType<typeof kolorist>[]): (str: string | number) => string | number;
|
|
18
|
-
declare function stripColors(str: string | number): string;
|
|
19
|
-
declare const reset: (str: string | number) => string;
|
|
20
|
-
declare const bold: (str: string | number) => string;
|
|
21
|
-
declare const dim: (str: string | number) => string;
|
|
22
|
-
declare const italic: (str: string | number) => string;
|
|
23
|
-
declare const underline: (str: string | number) => string;
|
|
24
|
-
declare const inverse: (str: string | number) => string;
|
|
25
|
-
declare const hidden: (str: string | number) => string;
|
|
26
|
-
declare const strikethrough: (str: string | number) => string;
|
|
27
|
-
declare const black: (str: string | number) => string;
|
|
28
|
-
declare const red: (str: string | number) => string;
|
|
29
|
-
declare const green: (str: string | number) => string;
|
|
30
|
-
declare const yellow: (str: string | number) => string;
|
|
31
|
-
declare const blue: (str: string | number) => string;
|
|
32
|
-
declare const magenta: (str: string | number) => string;
|
|
33
|
-
declare const cyan: (str: string | number) => string;
|
|
34
|
-
declare const white: (str: string | number) => string;
|
|
35
|
-
declare const gray: (str: string | number) => string;
|
|
36
|
-
declare const lightRed: (str: string | number) => string;
|
|
37
|
-
declare const lightGreen: (str: string | number) => string;
|
|
38
|
-
declare const lightYellow: (str: string | number) => string;
|
|
39
|
-
declare const lightBlue: (str: string | number) => string;
|
|
40
|
-
declare const lightMagenta: (str: string | number) => string;
|
|
41
|
-
declare const lightCyan: (str: string | number) => string;
|
|
42
|
-
declare const lightGray: (str: string | number) => string;
|
|
43
|
-
declare const bgBlack: (str: string | number) => string;
|
|
44
|
-
declare const bgRed: (str: string | number) => string;
|
|
45
|
-
declare const bgGreen: (str: string | number) => string;
|
|
46
|
-
declare const bgYellow: (str: string | number) => string;
|
|
47
|
-
declare const bgBlue: (str: string | number) => string;
|
|
48
|
-
declare const bgMagenta: (str: string | number) => string;
|
|
49
|
-
declare const bgCyan: (str: string | number) => string;
|
|
50
|
-
declare const bgWhite: (str: string | number) => string;
|
|
51
|
-
declare const bgGray: (str: string | number) => string;
|
|
52
|
-
declare const bgLightRed: (str: string | number) => string;
|
|
53
|
-
declare const bgLightGreen: (str: string | number) => string;
|
|
54
|
-
declare const bgLightYellow: (str: string | number) => string;
|
|
55
|
-
declare const bgLightBlue: (str: string | number) => string;
|
|
56
|
-
declare const bgLightMagenta: (str: string | number) => string;
|
|
57
|
-
declare const bgLightCyan: (str: string | number) => string;
|
|
58
|
-
declare const bgLightGray: (str: string | number) => string;
|
|
59
|
-
declare const ansi256: (n: number) => (str: string | number) => string;
|
|
60
|
-
declare const ansi256Bg: (n: number) => (str: string | number) => string;
|
|
61
|
-
declare function link(text: string, url: string): string;
|
|
62
|
-
|
|
63
|
-
export { SupportLevel, ansi256, ansi256Bg, bgBlack, bgBlue, bgCyan, bgGray, bgGreen, bgLightBlue, bgLightCyan, bgLightGray, bgLightGreen, bgLightMagenta, bgLightRed, bgLightYellow, bgMagenta, bgRed, bgWhite, bgYellow, black, blue, bold, combine, cyan, dim, gray, green, hidden, inverse, italic, lightBlue, lightCyan, lightGray, lightGreen, lightMagenta, lightRed, lightYellow, link, magenta, options, red, reset, strikethrough, stripColors, underline, white, yellow };
|