chalk 4.0.0 → 5.0.0
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/license +1 -1
- package/package.json +33 -24
- package/readme.md +90 -65
- package/source/index.d.ts +318 -0
- package/source/index.js +70 -80
- package/source/{util.js → utilities.js} +7 -13
- package/source/vendor/ansi-styles/index.d.ts +190 -0
- package/source/vendor/ansi-styles/index.js +219 -0
- package/source/vendor/supports-color/browser.d.ts +1 -0
- package/source/vendor/supports-color/browser.js +17 -0
- package/source/vendor/supports-color/index.d.ts +55 -0
- package/source/vendor/supports-color/index.js +169 -0
- package/index.d.ts +0 -408
- package/source/templates.js +0 -134
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* eslint-env browser */
|
|
2
|
+
|
|
3
|
+
const isBlinkBasedBrowser = /\b(Chrome|Chromium)\//.test(navigator.userAgent);
|
|
4
|
+
|
|
5
|
+
const colorSupport = isBlinkBasedBrowser ? {
|
|
6
|
+
level: 1,
|
|
7
|
+
hasBasic: true,
|
|
8
|
+
has256: false,
|
|
9
|
+
has16m: false,
|
|
10
|
+
} : false;
|
|
11
|
+
|
|
12
|
+
const supportsColor = {
|
|
13
|
+
stdout: colorSupport,
|
|
14
|
+
stderr: colorSupport,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default supportsColor;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {WriteStream} from 'node:tty';
|
|
2
|
+
|
|
3
|
+
export interface Options {
|
|
4
|
+
/**
|
|
5
|
+
Whether `process.argv` should be sniffed for `--color` and `--no-color` flags.
|
|
6
|
+
|
|
7
|
+
@default true
|
|
8
|
+
*/
|
|
9
|
+
readonly sniffFlags?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
Levels:
|
|
14
|
+
- `0` - All colors disabled.
|
|
15
|
+
- `1` - Basic 16 colors support.
|
|
16
|
+
- `2` - ANSI 256 colors support.
|
|
17
|
+
- `3` - Truecolor 16 million colors support.
|
|
18
|
+
*/
|
|
19
|
+
export type ColorSupportLevel = 0 | 1 | 2 | 3;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
Detect whether the terminal supports color.
|
|
23
|
+
*/
|
|
24
|
+
export interface ColorSupport {
|
|
25
|
+
/**
|
|
26
|
+
The color level.
|
|
27
|
+
*/
|
|
28
|
+
level: ColorSupportLevel;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
Whether basic 16 colors are supported.
|
|
32
|
+
*/
|
|
33
|
+
hasBasic: boolean;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
Whether ANSI 256 colors are supported.
|
|
37
|
+
*/
|
|
38
|
+
has256: boolean;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
Whether Truecolor 16 million colors are supported.
|
|
42
|
+
*/
|
|
43
|
+
has16m: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type ColorInfo = ColorSupport | false;
|
|
47
|
+
|
|
48
|
+
export function createSupportsColor(stream: WriteStream, options?: Options): ColorInfo;
|
|
49
|
+
|
|
50
|
+
declare const supportsColor: {
|
|
51
|
+
stdout: ColorInfo;
|
|
52
|
+
stderr: ColorInfo;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default supportsColor;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import tty from 'node:tty';
|
|
4
|
+
|
|
5
|
+
// From: https://github.com/sindresorhus/has-flag/blob/main/index.js
|
|
6
|
+
function hasFlag(flag, argv = process.argv) {
|
|
7
|
+
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
|
8
|
+
const position = argv.indexOf(prefix + flag);
|
|
9
|
+
const terminatorPosition = argv.indexOf('--');
|
|
10
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const {env} = process;
|
|
14
|
+
|
|
15
|
+
let flagForceColor;
|
|
16
|
+
if (
|
|
17
|
+
hasFlag('no-color')
|
|
18
|
+
|| hasFlag('no-colors')
|
|
19
|
+
|| hasFlag('color=false')
|
|
20
|
+
|| hasFlag('color=never')
|
|
21
|
+
) {
|
|
22
|
+
flagForceColor = 0;
|
|
23
|
+
} else if (
|
|
24
|
+
hasFlag('color')
|
|
25
|
+
|| hasFlag('colors')
|
|
26
|
+
|| hasFlag('color=true')
|
|
27
|
+
|| hasFlag('color=always')
|
|
28
|
+
) {
|
|
29
|
+
flagForceColor = 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function envForceColor() {
|
|
33
|
+
if ('FORCE_COLOR' in env) {
|
|
34
|
+
if (env.FORCE_COLOR === 'true') {
|
|
35
|
+
return 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (env.FORCE_COLOR === 'false') {
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function translateLevel(level) {
|
|
47
|
+
if (level === 0) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
level,
|
|
53
|
+
hasBasic: true,
|
|
54
|
+
has256: level >= 2,
|
|
55
|
+
has16m: level >= 3,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
|
|
60
|
+
const noFlagForceColor = envForceColor();
|
|
61
|
+
if (noFlagForceColor !== undefined) {
|
|
62
|
+
flagForceColor = noFlagForceColor;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
66
|
+
|
|
67
|
+
if (forceColor === 0) {
|
|
68
|
+
return 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (sniffFlags) {
|
|
72
|
+
if (hasFlag('color=16m')
|
|
73
|
+
|| hasFlag('color=full')
|
|
74
|
+
|| hasFlag('color=truecolor')) {
|
|
75
|
+
return 3;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (hasFlag('color=256')) {
|
|
79
|
+
return 2;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const min = forceColor || 0;
|
|
88
|
+
|
|
89
|
+
if (env.TERM === 'dumb') {
|
|
90
|
+
return min;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (process.platform === 'win32') {
|
|
94
|
+
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
|
95
|
+
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
|
96
|
+
const osRelease = os.release().split('.');
|
|
97
|
+
if (
|
|
98
|
+
Number(osRelease[0]) >= 10
|
|
99
|
+
&& Number(osRelease[2]) >= 10_586
|
|
100
|
+
) {
|
|
101
|
+
return Number(osRelease[2]) >= 14_931 ? 3 : 2;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return 1;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if ('CI' in env) {
|
|
108
|
+
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|
109
|
+
return 1;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return min;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if ('TEAMCITY_VERSION' in env) {
|
|
116
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Check for Azure DevOps pipelines
|
|
120
|
+
if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
|
|
121
|
+
return 1;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (env.COLORTERM === 'truecolor') {
|
|
125
|
+
return 3;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if ('TERM_PROGRAM' in env) {
|
|
129
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
130
|
+
|
|
131
|
+
switch (env.TERM_PROGRAM) {
|
|
132
|
+
case 'iTerm.app':
|
|
133
|
+
return version >= 3 ? 3 : 2;
|
|
134
|
+
case 'Apple_Terminal':
|
|
135
|
+
return 2;
|
|
136
|
+
// No default
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
141
|
+
return 2;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
145
|
+
return 1;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if ('COLORTERM' in env) {
|
|
149
|
+
return 1;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return min;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function createSupportsColor(stream, options = {}) {
|
|
156
|
+
const level = _supportsColor(stream, {
|
|
157
|
+
streamIsTTY: stream && stream.isTTY,
|
|
158
|
+
...options,
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
return translateLevel(level);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const supportsColor = {
|
|
165
|
+
stdout: createSupportsColor({isTTY: tty.isatty(1)}),
|
|
166
|
+
stderr: createSupportsColor({isTTY: tty.isatty(2)}),
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export default supportsColor;
|
package/index.d.ts
DELETED
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Basic foreground colors.
|
|
3
|
-
|
|
4
|
-
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
|
5
|
-
*/
|
|
6
|
-
declare type ForegroundColor =
|
|
7
|
-
| 'black'
|
|
8
|
-
| 'red'
|
|
9
|
-
| 'green'
|
|
10
|
-
| 'yellow'
|
|
11
|
-
| 'blue'
|
|
12
|
-
| 'magenta'
|
|
13
|
-
| 'cyan'
|
|
14
|
-
| 'white'
|
|
15
|
-
| 'gray'
|
|
16
|
-
| 'grey'
|
|
17
|
-
| 'blackBright'
|
|
18
|
-
| 'redBright'
|
|
19
|
-
| 'greenBright'
|
|
20
|
-
| 'yellowBright'
|
|
21
|
-
| 'blueBright'
|
|
22
|
-
| 'magentaBright'
|
|
23
|
-
| 'cyanBright'
|
|
24
|
-
| 'whiteBright';
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
Basic background colors.
|
|
28
|
-
|
|
29
|
-
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
|
30
|
-
*/
|
|
31
|
-
declare type BackgroundColor =
|
|
32
|
-
| 'bgBlack'
|
|
33
|
-
| 'bgRed'
|
|
34
|
-
| 'bgGreen'
|
|
35
|
-
| 'bgYellow'
|
|
36
|
-
| 'bgBlue'
|
|
37
|
-
| 'bgMagenta'
|
|
38
|
-
| 'bgCyan'
|
|
39
|
-
| 'bgWhite'
|
|
40
|
-
| 'bgGray'
|
|
41
|
-
| 'bgGrey'
|
|
42
|
-
| 'bgBlackBright'
|
|
43
|
-
| 'bgRedBright'
|
|
44
|
-
| 'bgGreenBright'
|
|
45
|
-
| 'bgYellowBright'
|
|
46
|
-
| 'bgBlueBright'
|
|
47
|
-
| 'bgMagentaBright'
|
|
48
|
-
| 'bgCyanBright'
|
|
49
|
-
| 'bgWhiteBright';
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
Basic colors.
|
|
53
|
-
|
|
54
|
-
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
|
55
|
-
*/
|
|
56
|
-
declare type Color = ForegroundColor | BackgroundColor;
|
|
57
|
-
|
|
58
|
-
declare type Modifiers =
|
|
59
|
-
| 'reset'
|
|
60
|
-
| 'bold'
|
|
61
|
-
| 'dim'
|
|
62
|
-
| 'italic'
|
|
63
|
-
| 'underline'
|
|
64
|
-
| 'inverse'
|
|
65
|
-
| 'hidden'
|
|
66
|
-
| 'strikethrough'
|
|
67
|
-
| 'visible';
|
|
68
|
-
|
|
69
|
-
declare namespace chalk {
|
|
70
|
-
/**
|
|
71
|
-
Levels:
|
|
72
|
-
- `0` - All colors disabled.
|
|
73
|
-
- `1` - Basic 16 colors support.
|
|
74
|
-
- `2` - ANSI 256 colors support.
|
|
75
|
-
- `3` - Truecolor 16 million colors support.
|
|
76
|
-
*/
|
|
77
|
-
type Level = 0 | 1 | 2 | 3;
|
|
78
|
-
|
|
79
|
-
interface Options {
|
|
80
|
-
/**
|
|
81
|
-
Specify the color support for Chalk.
|
|
82
|
-
|
|
83
|
-
By default, color support is automatically detected based on the environment.
|
|
84
|
-
|
|
85
|
-
Levels:
|
|
86
|
-
- `0` - All colors disabled.
|
|
87
|
-
- `1` - Basic 16 colors support.
|
|
88
|
-
- `2` - ANSI 256 colors support.
|
|
89
|
-
- `3` - Truecolor 16 million colors support.
|
|
90
|
-
*/
|
|
91
|
-
level?: Level;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
Return a new Chalk instance.
|
|
96
|
-
*/
|
|
97
|
-
type Instance = new (options?: Options) => Chalk;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
Detect whether the terminal supports color.
|
|
101
|
-
*/
|
|
102
|
-
interface ColorSupport {
|
|
103
|
-
/**
|
|
104
|
-
The color level used by Chalk.
|
|
105
|
-
*/
|
|
106
|
-
level: Level;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
Return whether Chalk supports basic 16 colors.
|
|
110
|
-
*/
|
|
111
|
-
hasBasic: boolean;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
Return whether Chalk supports ANSI 256 colors.
|
|
115
|
-
*/
|
|
116
|
-
has256: boolean;
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
Return whether Chalk supports Truecolor 16 million colors.
|
|
120
|
-
*/
|
|
121
|
-
has16m: boolean;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
interface ChalkFunction {
|
|
125
|
-
/**
|
|
126
|
-
Use a template string.
|
|
127
|
-
|
|
128
|
-
@remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341))
|
|
129
|
-
|
|
130
|
-
@example
|
|
131
|
-
```
|
|
132
|
-
import chalk = require('chalk');
|
|
133
|
-
|
|
134
|
-
log(chalk`
|
|
135
|
-
CPU: {red ${cpu.totalPercent}%}
|
|
136
|
-
RAM: {green ${ram.used / ram.total * 100}%}
|
|
137
|
-
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
|
138
|
-
`);
|
|
139
|
-
```
|
|
140
|
-
*/
|
|
141
|
-
(text: TemplateStringsArray, ...placeholders: unknown[]): string;
|
|
142
|
-
|
|
143
|
-
(...text: unknown[]): string;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
interface Chalk extends ChalkFunction {
|
|
147
|
-
/**
|
|
148
|
-
Return a new Chalk instance.
|
|
149
|
-
*/
|
|
150
|
-
Instance: Instance;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
The color support for Chalk.
|
|
154
|
-
|
|
155
|
-
By default, color support is automatically detected based on the environment.
|
|
156
|
-
|
|
157
|
-
Levels:
|
|
158
|
-
- `0` - All colors disabled.
|
|
159
|
-
- `1` - Basic 16 colors support.
|
|
160
|
-
- `2` - ANSI 256 colors support.
|
|
161
|
-
- `3` - Truecolor 16 million colors support.
|
|
162
|
-
*/
|
|
163
|
-
level: Level;
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
Use HEX value to set text color.
|
|
167
|
-
|
|
168
|
-
@param color - Hexadecimal value representing the desired color.
|
|
169
|
-
|
|
170
|
-
@example
|
|
171
|
-
```
|
|
172
|
-
import chalk = require('chalk');
|
|
173
|
-
|
|
174
|
-
chalk.hex('#DEADED');
|
|
175
|
-
```
|
|
176
|
-
*/
|
|
177
|
-
hex(color: string): Chalk;
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
Use keyword color value to set text color.
|
|
181
|
-
|
|
182
|
-
@param color - Keyword value representing the desired color.
|
|
183
|
-
|
|
184
|
-
@example
|
|
185
|
-
```
|
|
186
|
-
import chalk = require('chalk');
|
|
187
|
-
|
|
188
|
-
chalk.keyword('orange');
|
|
189
|
-
```
|
|
190
|
-
*/
|
|
191
|
-
keyword(color: string): Chalk;
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
Use RGB values to set text color.
|
|
195
|
-
*/
|
|
196
|
-
rgb(red: number, green: number, blue: number): Chalk;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
Use HSL values to set text color.
|
|
200
|
-
*/
|
|
201
|
-
hsl(hue: number, saturation: number, lightness: number): Chalk;
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
Use HSV values to set text color.
|
|
205
|
-
*/
|
|
206
|
-
hsv(hue: number, saturation: number, value: number): Chalk;
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
Use HWB values to set text color.
|
|
210
|
-
*/
|
|
211
|
-
hwb(hue: number, whiteness: number, blackness: number): Chalk;
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color.
|
|
215
|
-
|
|
216
|
-
30 <= code && code < 38 || 90 <= code && code < 98
|
|
217
|
-
For example, 31 for red, 91 for redBright.
|
|
218
|
-
*/
|
|
219
|
-
ansi(code: number): Chalk;
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
|
223
|
-
*/
|
|
224
|
-
ansi256(index: number): Chalk;
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
Use HEX value to set background color.
|
|
228
|
-
|
|
229
|
-
@param color - Hexadecimal value representing the desired color.
|
|
230
|
-
|
|
231
|
-
@example
|
|
232
|
-
```
|
|
233
|
-
import chalk = require('chalk');
|
|
234
|
-
|
|
235
|
-
chalk.bgHex('#DEADED');
|
|
236
|
-
```
|
|
237
|
-
*/
|
|
238
|
-
bgHex(color: string): Chalk;
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
Use keyword color value to set background color.
|
|
242
|
-
|
|
243
|
-
@param color - Keyword value representing the desired color.
|
|
244
|
-
|
|
245
|
-
@example
|
|
246
|
-
```
|
|
247
|
-
import chalk = require('chalk');
|
|
248
|
-
|
|
249
|
-
chalk.bgKeyword('orange');
|
|
250
|
-
```
|
|
251
|
-
*/
|
|
252
|
-
bgKeyword(color: string): Chalk;
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
Use RGB values to set background color.
|
|
256
|
-
*/
|
|
257
|
-
bgRgb(red: number, green: number, blue: number): Chalk;
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
Use HSL values to set background color.
|
|
261
|
-
*/
|
|
262
|
-
bgHsl(hue: number, saturation: number, lightness: number): Chalk;
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
Use HSV values to set background color.
|
|
266
|
-
*/
|
|
267
|
-
bgHsv(hue: number, saturation: number, value: number): Chalk;
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
Use HWB values to set background color.
|
|
271
|
-
*/
|
|
272
|
-
bgHwb(hue: number, whiteness: number, blackness: number): Chalk;
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color.
|
|
276
|
-
|
|
277
|
-
30 <= code && code < 38 || 90 <= code && code < 98
|
|
278
|
-
For example, 31 for red, 91 for redBright.
|
|
279
|
-
Use the foreground code, not the background code (for example, not 41, nor 101).
|
|
280
|
-
*/
|
|
281
|
-
bgAnsi(code: number): Chalk;
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
|
|
285
|
-
*/
|
|
286
|
-
bgAnsi256(index: number): Chalk;
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
Modifier: Resets the current color chain.
|
|
290
|
-
*/
|
|
291
|
-
readonly reset: Chalk;
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
Modifier: Make text bold.
|
|
295
|
-
*/
|
|
296
|
-
readonly bold: Chalk;
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
Modifier: Emitting only a small amount of light.
|
|
300
|
-
*/
|
|
301
|
-
readonly dim: Chalk;
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
Modifier: Make text italic. (Not widely supported)
|
|
305
|
-
*/
|
|
306
|
-
readonly italic: Chalk;
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
Modifier: Make text underline. (Not widely supported)
|
|
310
|
-
*/
|
|
311
|
-
readonly underline: Chalk;
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
Modifier: Inverse background and foreground colors.
|
|
315
|
-
*/
|
|
316
|
-
readonly inverse: Chalk;
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
Modifier: Prints the text, but makes it invisible.
|
|
320
|
-
*/
|
|
321
|
-
readonly hidden: Chalk;
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
Modifier: Puts a horizontal line through the center of the text. (Not widely supported)
|
|
325
|
-
*/
|
|
326
|
-
readonly strikethrough: Chalk;
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
Modifier: Prints the text only when Chalk has a color support level > 0.
|
|
330
|
-
Can be useful for things that are purely cosmetic.
|
|
331
|
-
*/
|
|
332
|
-
readonly visible: Chalk;
|
|
333
|
-
|
|
334
|
-
readonly black: Chalk;
|
|
335
|
-
readonly red: Chalk;
|
|
336
|
-
readonly green: Chalk;
|
|
337
|
-
readonly yellow: Chalk;
|
|
338
|
-
readonly blue: Chalk;
|
|
339
|
-
readonly magenta: Chalk;
|
|
340
|
-
readonly cyan: Chalk;
|
|
341
|
-
readonly white: Chalk;
|
|
342
|
-
|
|
343
|
-
/*
|
|
344
|
-
Alias for `blackBright`.
|
|
345
|
-
*/
|
|
346
|
-
readonly gray: Chalk;
|
|
347
|
-
|
|
348
|
-
/*
|
|
349
|
-
Alias for `blackBright`.
|
|
350
|
-
*/
|
|
351
|
-
readonly grey: Chalk;
|
|
352
|
-
|
|
353
|
-
readonly blackBright: Chalk;
|
|
354
|
-
readonly redBright: Chalk;
|
|
355
|
-
readonly greenBright: Chalk;
|
|
356
|
-
readonly yellowBright: Chalk;
|
|
357
|
-
readonly blueBright: Chalk;
|
|
358
|
-
readonly magentaBright: Chalk;
|
|
359
|
-
readonly cyanBright: Chalk;
|
|
360
|
-
readonly whiteBright: Chalk;
|
|
361
|
-
|
|
362
|
-
readonly bgBlack: Chalk;
|
|
363
|
-
readonly bgRed: Chalk;
|
|
364
|
-
readonly bgGreen: Chalk;
|
|
365
|
-
readonly bgYellow: Chalk;
|
|
366
|
-
readonly bgBlue: Chalk;
|
|
367
|
-
readonly bgMagenta: Chalk;
|
|
368
|
-
readonly bgCyan: Chalk;
|
|
369
|
-
readonly bgWhite: Chalk;
|
|
370
|
-
|
|
371
|
-
/*
|
|
372
|
-
Alias for `bgBlackBright`.
|
|
373
|
-
*/
|
|
374
|
-
readonly bgGray: Chalk;
|
|
375
|
-
|
|
376
|
-
/*
|
|
377
|
-
Alias for `bgBlackBright`.
|
|
378
|
-
*/
|
|
379
|
-
readonly bgGrey: Chalk;
|
|
380
|
-
|
|
381
|
-
readonly bgBlackBright: Chalk;
|
|
382
|
-
readonly bgRedBright: Chalk;
|
|
383
|
-
readonly bgGreenBright: Chalk;
|
|
384
|
-
readonly bgYellowBright: Chalk;
|
|
385
|
-
readonly bgBlueBright: Chalk;
|
|
386
|
-
readonly bgMagentaBright: Chalk;
|
|
387
|
-
readonly bgCyanBright: Chalk;
|
|
388
|
-
readonly bgWhiteBright: Chalk;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
Main Chalk object that allows to chain styles together.
|
|
394
|
-
Call the last one as a method with a string argument.
|
|
395
|
-
Order doesn't matter, and later styles take precedent in case of a conflict.
|
|
396
|
-
This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
|
397
|
-
*/
|
|
398
|
-
declare const chalk: chalk.Chalk & chalk.ChalkFunction & {
|
|
399
|
-
supportsColor: chalk.ColorSupport | false;
|
|
400
|
-
Level: chalk.Level;
|
|
401
|
-
Color: Color;
|
|
402
|
-
ForegroundColor: ForegroundColor;
|
|
403
|
-
BackgroundColor: BackgroundColor;
|
|
404
|
-
Modifiers: Modifiers;
|
|
405
|
-
stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false};
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
export = chalk;
|