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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
4
 
5
5
  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:
6
6
 
package/package.json CHANGED
@@ -1,21 +1,30 @@
1
1
  {
2
2
  "name": "chalk",
3
- "version": "4.0.0",
3
+ "version": "5.0.0",
4
4
  "description": "Terminal string styling done right",
5
5
  "license": "MIT",
6
6
  "repository": "chalk/chalk",
7
7
  "funding": "https://github.com/chalk/chalk?sponsor=1",
8
- "main": "source",
8
+ "type": "module",
9
+ "exports": "./source/index.js",
10
+ "imports": {
11
+ "#ansi-styles": "./source/vendor/ansi-styles/index.js",
12
+ "#supports-color": {
13
+ "node": "./source/vendor/supports-color/index.js",
14
+ "default": "./source/vendor/supports-color/browser.js"
15
+ }
16
+ },
17
+ "types": "./source/index.d.ts",
9
18
  "engines": {
10
- "node": ">=10"
19
+ "node": "^12.17.0 || ^14.13 || >=16.0.0"
11
20
  },
12
21
  "scripts": {
13
- "test": "xo && nyc ava && tsd",
22
+ "test": "xo && c8 ava && tsd",
14
23
  "bench": "matcha benchmark.js"
15
24
  },
16
25
  "files": [
17
26
  "source",
18
- "index.d.ts"
27
+ "!source/index.test-d.ts"
19
28
  ],
20
29
  "keywords": [
21
30
  "color",
@@ -25,7 +34,6 @@
25
34
  "console",
26
35
  "cli",
27
36
  "string",
28
- "str",
29
37
  "ansi",
30
38
  "style",
31
39
  "styles",
@@ -40,29 +48,30 @@
40
48
  "command-line",
41
49
  "text"
42
50
  ],
43
- "dependencies": {
44
- "ansi-styles": "^4.1.0",
45
- "supports-color": "^7.1.0"
46
- },
47
51
  "devDependencies": {
48
- "ava": "^2.4.0",
49
- "coveralls": "^3.0.7",
50
- "execa": "^4.0.0",
51
- "import-fresh": "^3.1.0",
52
+ "@types/node": "^16.11.10",
53
+ "ava": "^3.15.0",
54
+ "c8": "^7.10.0",
55
+ "color-convert": "^2.0.1",
56
+ "execa": "^6.0.0",
57
+ "log-update": "^5.0.0",
52
58
  "matcha": "^0.7.0",
53
- "nyc": "^15.0.0",
54
- "resolve-from": "^5.0.0",
55
- "tsd": "^0.7.4",
56
- "xo": "^0.28.2"
59
+ "tsd": "^0.19.0",
60
+ "xo": "^0.47.0",
61
+ "yoctodelay": "^2.0.0"
57
62
  },
58
63
  "xo": {
59
64
  "rules": {
60
- "unicorn/prefer-string-slice": "off",
61
- "unicorn/prefer-includes": "off",
62
- "@typescript-eslint/member-ordering": "off",
63
- "no-redeclare": "off",
64
- "unicorn/string-content": "off",
65
- "unicorn/better-regex": "off"
65
+ "unicorn/prefer-string-slice": "off"
66
66
  }
67
+ },
68
+ "c8": {
69
+ "reporter": [
70
+ "text",
71
+ "lcov"
72
+ ],
73
+ "exclude": [
74
+ "source/vendor"
75
+ ]
67
76
  }
68
77
  }
package/readme.md CHANGED
@@ -9,32 +9,90 @@
9
9
 
10
10
  > Terminal string styling done right
11
11
 
12
- [![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript-ready](https://img.shields.io/npm/types/chalk.svg) [![run on repl.it](http://repl.it/badge/github/chalk/chalk)](https://repl.it/github/chalk/chalk)
12
+ [![Coverage Status](https://codecov.io/gh/chalk/chalk/branch/main/graph/badge.svg)](https://codecov.io/gh/chalk/chalk)
13
+ [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk)
14
+ [![run on repl.it](https://repl.it/badge/github/chalk/chalk)](https://repl.it/github/chalk/chalk)
15
+ [![Support Chalk on DEV](https://badge.devprotocol.xyz/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15/descriptive)](https://stakes.social/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15)
13
16
 
14
17
  <img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
15
18
 
19
+ <br>
20
+
21
+ ---
22
+
23
+ <div align="center">
24
+ <p>
25
+ <p>
26
+ <sup>
27
+ Sindre Sorhus' open source work is supported by the community on <a href="https://github.com/sponsors/sindresorhus">GitHub Sponsors</a> and <a href="https://stakes.social/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15">Dev</a>
28
+ </sup>
29
+ </p>
30
+ <sup>Special thanks to:</sup>
31
+ <br>
32
+ <br>
33
+ <a href="https://standardresume.co/tech">
34
+ <img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="160"/>
35
+ </a>
36
+ <br>
37
+ <br>
38
+ <a href="https://retool.com/?utm_campaign=sindresorhus">
39
+ <img src="https://sindresorhus.com/assets/thanks/retool-logo.svg" width="230"/>
40
+ </a>
41
+ <br>
42
+ <br>
43
+ <a href="https://doppler.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=chalk&utm_source=github">
44
+ <div>
45
+ <img src="https://dashboard.doppler.com/imgs/logo-long.svg" width="240" alt="Doppler">
46
+ </div>
47
+ <b>All your environment variables, in one place</b>
48
+ <div>
49
+ <span>Stop struggling with scattered API keys, hacking together home-brewed tools,</span>
50
+ <br>
51
+ <span>and avoiding access controls. Keep your team and servers in sync with Doppler.</span>
52
+ </div>
53
+ </a>
54
+ <br>
55
+ <a href="https://strapi.io/?ref=sindresorhus">
56
+ <div>
57
+ <img src="https://sindresorhus.com/assets/thanks/strapi-logo-white-bg.png" width="220" alt="Strapi">
58
+ </div>
59
+ <b>Strapi is the leading open-source headless CMS.</b>
60
+ <div>
61
+ <sup>It’s 100% JavaScript, fully customizable, and developer-first.</sup>
62
+ </div>
63
+ </a>
64
+ </p>
65
+ </div>
66
+
67
+ ---
68
+
69
+ <br>
70
+
16
71
  ## Highlights
17
72
 
18
73
  - Expressive API
19
74
  - Highly performant
75
+ - No dependencies
20
76
  - Ability to nest styles
21
77
  - [256/Truecolor color support](#256-and-truecolor-color-support)
22
78
  - Auto-detects color support
23
79
  - Doesn't extend `String.prototype`
24
80
  - Clean and focused
25
81
  - Actively maintained
26
- - [Used by ~50,000 packages](https://www.npmjs.com/browse/depended/chalk) as of January 1, 2020
82
+ - [Used by ~76,000 packages](https://www.npmjs.com/browse/depended/chalk) as of October 26, 2021
27
83
 
28
84
  ## Install
29
85
 
30
- ```console
31
- $ npm install chalk
86
+ ```sh
87
+ npm install chalk
32
88
  ```
33
89
 
90
+ **IMPORTANT:** Chalk 5 is ESM. If you want to use Chalk with TypeScript or a build tool, you will probably want to use Chalk 4 for now. [Read more.](https://github.com/chalk/chalk/releases/tag/v5.0.0)
91
+
34
92
  ## Usage
35
93
 
36
94
  ```js
37
- const chalk = require('chalk');
95
+ import chalk from 'chalk';
38
96
 
39
97
  console.log(chalk.blue('Hello world!'));
40
98
  ```
@@ -42,7 +100,8 @@ console.log(chalk.blue('Hello world!'));
42
100
  Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
43
101
 
44
102
  ```js
45
- const chalk = require('chalk');
103
+ import chalk from 'chalk';
104
+
46
105
  const log = console.log;
47
106
 
48
107
  // Combine styled and normal strings
@@ -71,15 +130,7 @@ RAM: ${chalk.green('40%')}
71
130
  DISK: ${chalk.yellow('70%')}
72
131
  `);
73
132
 
74
- // ES2015 tagged template literal
75
- log(chalk`
76
- CPU: {red ${cpu.totalPercent}%}
77
- RAM: {green ${ram.used / ram.total * 100}%}
78
- DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
79
- `);
80
-
81
133
  // Use RGB colors in terminal emulators that support it.
82
- log(chalk.keyword('orange')('Yay for orange colored text!'));
83
134
  log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
84
135
  log(chalk.hex('#DEADED').bold('Bold gray!'));
85
136
  ```
@@ -87,10 +138,10 @@ log(chalk.hex('#DEADED').bold('Bold gray!'));
87
138
  Easily define your own themes:
88
139
 
89
140
  ```js
90
- const chalk = require('chalk');
141
+ import chalk from 'chalk';
91
142
 
92
143
  const error = chalk.bold.red;
93
- const warning = chalk.keyword('orange');
144
+ const warning = chalk.hex('#FFA500'); // Orange color
94
145
 
95
146
  console.log(error('Error!'));
96
147
  console.log(warning('Warning!'));
@@ -99,6 +150,8 @@ console.log(warning('Warning!'));
99
150
  Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
100
151
 
101
152
  ```js
153
+ import chalk from 'chalk';
154
+
102
155
  const name = 'Sindre';
103
156
  console.log(chalk.green('Hello %s'), name);
104
157
  //=> 'Hello Sindre'
@@ -123,7 +176,9 @@ Color support is automatically detected, but you can override it by setting the
123
176
  If you need to change this in a reusable module, create a new instance:
124
177
 
125
178
  ```js
126
- const ctx = new chalk.Instance({level: 0});
179
+ import {Chalk} from 'chalk';
180
+
181
+ const customChalk = new Chalk({level: 0});
127
182
  ```
128
183
 
129
184
  | Level | Description |
@@ -133,7 +188,7 @@ const ctx = new chalk.Instance({level: 0});
133
188
  | `2` | 256 color support |
134
189
  | `3` | Truecolor support (16 million colors) |
135
190
 
136
- ### chalk.supportsColor
191
+ ### supportsColor
137
192
 
138
193
  Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
139
194
 
@@ -141,23 +196,24 @@ Can be overridden by the user with the flags `--color` and `--no-color`. For sit
141
196
 
142
197
  Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
143
198
 
144
- ### chalk.stderr and chalk.stderr.supportsColor
199
+ ### chalkStderr and supportsColorStderr
145
200
 
146
- `chalk.stderr` contains a separate instance configured with color support detected for `stderr` stream instead of `stdout`. Override rules from `chalk.supportsColor` apply to this too. `chalk.stderr.supportsColor` is exposed for convenience.
201
+ `chalkStderr` contains a separate instance configured with color support detected for `stderr` stream instead of `stdout`. Override rules from `supportsColor` apply to this too. `supportsColorStderr` is exposed for convenience.
147
202
 
148
203
  ## Styles
149
204
 
150
205
  ### Modifiers
151
206
 
152
- - `reset` - Resets the current color chain.
153
- - `bold` - Make text bold.
154
- - `dim` - Emitting only a small amount of light.
155
- - `italic` - Make text italic. *(Not widely supported)*
156
- - `underline` - Make text underline. *(Not widely supported)*
157
- - `inverse`- Inverse background and foreground colors.
158
- - `hidden` - Prints the text, but makes it invisible.
207
+ - `reset` - Reset the current style.
208
+ - `bold` - Make the text bold.
209
+ - `dim` - Make the text have lower opacity.
210
+ - `italic` - Make the text italic. *(Not widely supported)*
211
+ - `underline` - Put a horizontal line below the text. *(Not widely supported)*
212
+ - `overline` - Put a horizontal line above the text. *(Not widely supported)*
213
+ - `inverse`- Invert background and foreground colors.
214
+ - `hidden` - Print the text but make it invisible.
159
215
  - `strikethrough` - Puts a horizontal line through the center of the text. *(Not widely supported)*
160
- - `visible`- Prints the text only when Chalk has a color level > 0. Can be useful for things that are purely cosmetic.
216
+ - `visible`- Print the text only when Chalk has a color level above zero. Can be useful for things that are purely cosmetic.
161
217
 
162
218
  ### Colors
163
219
 
@@ -197,35 +253,6 @@ Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=
197
253
  - `bgCyanBright`
198
254
  - `bgWhiteBright`
199
255
 
200
- ## Tagged template literal
201
-
202
- Chalk can be used as a [tagged template literal](http://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
203
-
204
- ```js
205
- const chalk = require('chalk');
206
-
207
- const miles = 18;
208
- const calculateFeet = miles => miles * 5280;
209
-
210
- console.log(chalk`
211
- There are {bold 5280 feet} in a mile.
212
- In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
213
- `);
214
- ```
215
-
216
- Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
217
-
218
- Template styles are chained exactly like normal Chalk styles. The following two statements are equivalent:
219
-
220
- ```js
221
- console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
222
- console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
223
- ```
224
-
225
- Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
226
-
227
- All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
228
-
229
256
  ## 256 and Truecolor color support
230
257
 
231
258
  Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
@@ -235,26 +262,23 @@ Colors are downsampled from 16 million RGB values to an ANSI color format that i
235
262
  Examples:
236
263
 
237
264
  - `chalk.hex('#DEADED').underline('Hello, world!')`
238
- - `chalk.keyword('orange')('Some orange text')`
239
265
  - `chalk.rgb(15, 100, 204).inverse('Hello!')`
240
266
 
241
- Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
267
+ Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `hex` for foreground colors and `bgHex` for background colors).
242
268
 
243
269
  - `chalk.bgHex('#DEADED').underline('Hello, world!')`
244
- - `chalk.bgKeyword('orange')('Some orange text')`
245
270
  - `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
246
271
 
247
272
  The following color models can be used:
248
273
 
249
274
  - [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
250
275
  - [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
251
- - [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
252
- - [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
253
- - [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
254
- - [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
255
- - [`ansi`](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) - Example: `chalk.ansi(31).bgAnsi(93)('red on yellowBright')`
256
276
  - [`ansi256`](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) - Example: `chalk.bgAnsi256(194)('Honeydew, more or less')`
257
277
 
278
+ ## Browser support
279
+
280
+ Since Chrome 69, ANSI escape codes are natively supported in the developer console.
281
+
258
282
  ## Windows
259
283
 
260
284
  If you're on Windows, do yourself a favor and use [Windows Terminal](https://github.com/microsoft/terminal) instead of `cmd.exe`.
@@ -271,6 +295,7 @@ The maintainers of chalk and thousands of other packages are working with Tideli
271
295
 
272
296
  ## Related
273
297
 
298
+ - [chalk-template](https://github.com/chalk/chalk-template) - [Tagged template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates) support for this module
274
299
  - [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
275
300
  - [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
276
301
  - [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
@@ -0,0 +1,318 @@
1
+ // TODO: Make it this when TS suports that.
2
+ // import {ColorInfo, ColorSupportLevel} from '#supports-color';
3
+ import {ColorInfo, ColorSupportLevel} from './vendor/supports-color/index.js';
4
+
5
+ /**
6
+ Basic foreground colors.
7
+
8
+ [More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support)
9
+ */
10
+ export type ForegroundColor =
11
+ | 'black'
12
+ | 'red'
13
+ | 'green'
14
+ | 'yellow'
15
+ | 'blue'
16
+ | 'magenta'
17
+ | 'cyan'
18
+ | 'white'
19
+ | 'gray'
20
+ | 'grey'
21
+ | 'blackBright'
22
+ | 'redBright'
23
+ | 'greenBright'
24
+ | 'yellowBright'
25
+ | 'blueBright'
26
+ | 'magentaBright'
27
+ | 'cyanBright'
28
+ | 'whiteBright';
29
+
30
+ /**
31
+ Basic background colors.
32
+
33
+ [More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support)
34
+ */
35
+ export type BackgroundColor =
36
+ | 'bgBlack'
37
+ | 'bgRed'
38
+ | 'bgGreen'
39
+ | 'bgYellow'
40
+ | 'bgBlue'
41
+ | 'bgMagenta'
42
+ | 'bgCyan'
43
+ | 'bgWhite'
44
+ | 'bgGray'
45
+ | 'bgGrey'
46
+ | 'bgBlackBright'
47
+ | 'bgRedBright'
48
+ | 'bgGreenBright'
49
+ | 'bgYellowBright'
50
+ | 'bgBlueBright'
51
+ | 'bgMagentaBright'
52
+ | 'bgCyanBright'
53
+ | 'bgWhiteBright';
54
+
55
+ /**
56
+ Basic colors.
57
+
58
+ [More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support)
59
+ */
60
+ export type Color = ForegroundColor | BackgroundColor;
61
+
62
+ export type Modifiers =
63
+ | 'reset'
64
+ | 'bold'
65
+ | 'dim'
66
+ | 'italic'
67
+ | 'underline'
68
+ | 'overline'
69
+ | 'inverse'
70
+ | 'hidden'
71
+ | 'strikethrough'
72
+ | 'visible';
73
+
74
+ export interface Options {
75
+ /**
76
+ Specify the color support for Chalk.
77
+
78
+ By default, color support is automatically detected based on the environment.
79
+
80
+ Levels:
81
+ - `0` - All colors disabled.
82
+ - `1` - Basic 16 colors support.
83
+ - `2` - ANSI 256 colors support.
84
+ - `3` - Truecolor 16 million colors support.
85
+ */
86
+ readonly level?: ColorSupportLevel;
87
+ }
88
+
89
+ /**
90
+ Return a new Chalk instance.
91
+ */
92
+ export const Chalk: new (options?: Options) => ChalkInstance; // eslint-disable-line @typescript-eslint/naming-convention
93
+
94
+ export interface ChalkInstance {
95
+ (...text: unknown[]): string;
96
+
97
+ /**
98
+ The color support for Chalk.
99
+
100
+ By default, color support is automatically detected based on the environment.
101
+
102
+ Levels:
103
+ - `0` - All colors disabled.
104
+ - `1` - Basic 16 colors support.
105
+ - `2` - ANSI 256 colors support.
106
+ - `3` - Truecolor 16 million colors support.
107
+ */
108
+ level: ColorSupportLevel;
109
+
110
+ /**
111
+ Use RGB values to set text color.
112
+
113
+ @example
114
+ ```
115
+ import chalk from 'chalk';
116
+
117
+ chalk.rgb(222, 173, 237);
118
+ ```
119
+ */
120
+ rgb: (red: number, green: number, blue: number) => this;
121
+
122
+ /**
123
+ Use HEX value to set text color.
124
+
125
+ @param color - Hexadecimal value representing the desired color.
126
+
127
+ @example
128
+ ```
129
+ import chalk from 'chalk';
130
+
131
+ chalk.hex('#DEADED');
132
+ ```
133
+ */
134
+ hex: (color: string) => this;
135
+
136
+ /**
137
+ Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
138
+
139
+ @example
140
+ ```
141
+ import chalk from 'chalk';
142
+
143
+ chalk.ansi256(201);
144
+ ```
145
+ */
146
+ ansi256: (index: number) => this;
147
+
148
+ /**
149
+ Use RGB values to set background color.
150
+
151
+ @example
152
+ ```
153
+ import chalk from 'chalk';
154
+
155
+ chalk.bgRgb(222, 173, 237);
156
+ ```
157
+ */
158
+ bgRgb: (red: number, green: number, blue: number) => this;
159
+
160
+ /**
161
+ Use HEX value to set background color.
162
+
163
+ @param color - Hexadecimal value representing the desired color.
164
+
165
+ @example
166
+ ```
167
+ import chalk from 'chalk';
168
+
169
+ chalk.bgHex('#DEADED');
170
+ ```
171
+ */
172
+ bgHex: (color: string) => this;
173
+
174
+ /**
175
+ Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
176
+
177
+ @example
178
+ ```
179
+ import chalk from 'chalk';
180
+
181
+ chalk.bgAnsi256(201);
182
+ ```
183
+ */
184
+ bgAnsi256: (index: number) => this;
185
+
186
+ /**
187
+ Modifier: Reset the current style.
188
+ */
189
+ readonly reset: this;
190
+
191
+ /**
192
+ Modifier: Make the text bold.
193
+ */
194
+ readonly bold: this;
195
+
196
+ /**
197
+ Modifier: Make the text have lower opacity.
198
+ */
199
+ readonly dim: this;
200
+
201
+ /**
202
+ Modifier: Make the text italic. *(Not widely supported)*
203
+ */
204
+ readonly italic: this;
205
+
206
+ /**
207
+ Modifier: Put a horizontal line below the text. *(Not widely supported)*
208
+ */
209
+ readonly underline: this;
210
+
211
+ /**
212
+ Modifier: Put a horizontal line above the text. *(Not widely supported)*
213
+ */
214
+ readonly overline: this;
215
+
216
+ /**
217
+ Modifier: Invert background and foreground colors.
218
+ */
219
+ readonly inverse: this;
220
+
221
+ /**
222
+ Modifier: Print the text but make it invisible.
223
+ */
224
+ readonly hidden: this;
225
+
226
+ /**
227
+ Modifier: Puts a horizontal line through the center of the text. *(Not widely supported)*
228
+ */
229
+ readonly strikethrough: this;
230
+
231
+ /**
232
+ Modifier: Print the text only when Chalk has a color level above zero.
233
+
234
+ Can be useful for things that are purely cosmetic.
235
+ */
236
+ readonly visible: this;
237
+
238
+ readonly black: this;
239
+ readonly red: this;
240
+ readonly green: this;
241
+ readonly yellow: this;
242
+ readonly blue: this;
243
+ readonly magenta: this;
244
+ readonly cyan: this;
245
+ readonly white: this;
246
+
247
+ /*
248
+ Alias for `blackBright`.
249
+ */
250
+ readonly gray: this;
251
+
252
+ /*
253
+ Alias for `blackBright`.
254
+ */
255
+ readonly grey: this;
256
+
257
+ readonly blackBright: this;
258
+ readonly redBright: this;
259
+ readonly greenBright: this;
260
+ readonly yellowBright: this;
261
+ readonly blueBright: this;
262
+ readonly magentaBright: this;
263
+ readonly cyanBright: this;
264
+ readonly whiteBright: this;
265
+
266
+ readonly bgBlack: this;
267
+ readonly bgRed: this;
268
+ readonly bgGreen: this;
269
+ readonly bgYellow: this;
270
+ readonly bgBlue: this;
271
+ readonly bgMagenta: this;
272
+ readonly bgCyan: this;
273
+ readonly bgWhite: this;
274
+
275
+ /*
276
+ Alias for `bgBlackBright`.
277
+ */
278
+ readonly bgGray: this;
279
+
280
+ /*
281
+ Alias for `bgBlackBright`.
282
+ */
283
+ readonly bgGrey: this;
284
+
285
+ readonly bgBlackBright: this;
286
+ readonly bgRedBright: this;
287
+ readonly bgGreenBright: this;
288
+ readonly bgYellowBright: this;
289
+ readonly bgBlueBright: this;
290
+ readonly bgMagentaBright: this;
291
+ readonly bgCyanBright: this;
292
+ readonly bgWhiteBright: this;
293
+ }
294
+
295
+ /**
296
+ Main Chalk object that allows to chain styles together.
297
+
298
+ Call the last one as a method with a string argument.
299
+
300
+ Order doesn't matter, and later styles take precedent in case of a conflict.
301
+
302
+ This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
303
+ */
304
+ declare const chalk: ChalkInstance;
305
+
306
+ export const supportsColor: ColorInfo;
307
+
308
+ export const chalkStderr: typeof chalk;
309
+ export const supportsColorStderr: typeof supportsColor;
310
+
311
+ export {
312
+ ColorInfo,
313
+ ColorSupport,
314
+ ColorSupportLevel,
315
+ // } from '#supports-color';
316
+ } from './vendor/supports-color/index.js';
317
+
318
+ export default chalk;