Re-export types from supports-color

Signed-off-by: Richie Bendall <richiebendall@gmail.com>
This commit is contained in:
Richie Bendall 2021-11-21 18:37:10 +13:00
parent c987c61486
commit 8d18e3d58e
No known key found for this signature in database
GPG key ID: 1C6A99DFA9D306FC
5 changed files with 24 additions and 50 deletions

45
source/index.d.ts vendored
View file

@ -1,3 +1,5 @@
import type {ColorInfo, ColorSupport, ColorSupportLevel} from 'supports-color';
/**
Basic foreground colors.
@ -67,14 +69,11 @@ export type Modifiers =
| 'strikethrough'
| 'visible';
/**
Levels:
- `0` - All colors disabled.
- `1` - Basic 16 colors support.
- `2` - ANSI 256 colors support.
- `3` - Truecolor 16 million colors support.
*/
export type ColorSupportLevel = 0 | 1 | 2 | 3;
export {
ColorInfo,
ColorSupport,
ColorSupportLevel,
};
export interface Options {
/**
@ -94,32 +93,7 @@ export interface Options {
/**
Return a new Chalk instance.
*/
export const Chalk: new (options?: Options) => ChalkInstance;
/**
Detect whether the terminal supports color.
*/
export interface ColorSupport {
/**
The color level used by Chalk.
*/
level: ColorSupportLevel;
/**
Return whether Chalk supports basic 16 colors.
*/
hasBasic: boolean;
/**
Return whether Chalk supports ANSI 256 colors.
*/
has256: boolean;
/**
Return whether Chalk supports Truecolor 16 million colors.
*/
has16m: boolean;
}
export const Chalk: new (options?: Options) => ChalkInstance; // eslint-disable-line @typescript-eslint/naming-convention
export interface ChalkInstance {
(...text: unknown[]): string;
@ -333,8 +307,7 @@ This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
*/
declare const chalk: ChalkInstance;
export const supportsColor: ColorSupport | false;
export const supportsColor: ColorInfo;
export const chalkStderr: typeof chalk;
export const supportsColorStderr: typeof supportsColor;