Export Color type
This commit is contained in:
parent
7b9211be50
commit
bcf8ff9fe9
3 changed files with 82 additions and 1 deletions
39
index.d.ts
vendored
39
index.d.ts
vendored
|
|
@ -67,6 +67,45 @@ export interface ColorSupport {
|
|||
has16m: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Available colors for use
|
||||
*/
|
||||
export type Color =
|
||||
"black"
|
||||
| "red"
|
||||
| "green"
|
||||
| "yellow"
|
||||
| "blue"
|
||||
| "magenta"
|
||||
| "cyan"
|
||||
| "white"
|
||||
| "gray"
|
||||
| "grey"
|
||||
| "blackBright"
|
||||
| "redBright"
|
||||
| "greenBright"
|
||||
| "yellowBright"
|
||||
| "blueBright"
|
||||
| "magentaBright"
|
||||
| "cyanBright"
|
||||
| "whiteBright"
|
||||
| "bgBlack"
|
||||
| "bgRed"
|
||||
| "bgGreen"
|
||||
| "bgYellow"
|
||||
| "bgBlue"
|
||||
| "bgMagenta"
|
||||
| "bgCyan"
|
||||
| "bgWhite"
|
||||
| "bgBlackBright"
|
||||
| "bgRedBright"
|
||||
| "bgGreenBright"
|
||||
| "bgYellowBright"
|
||||
| "bgBlueBright"
|
||||
| "bgMagentaBright"
|
||||
| "bgCyanBright"
|
||||
| "bgWhiteBright";
|
||||
|
||||
export interface Chalk {
|
||||
(...text: unknown[]): string;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,45 @@ export type ColorSupport = {|
|
|||
has16m: boolean
|
||||
|};
|
||||
|
||||
/**
|
||||
* Available colors for use
|
||||
*/
|
||||
export type Color =
|
||||
"black"
|
||||
| "red"
|
||||
| "green"
|
||||
| "yellow"
|
||||
| "blue"
|
||||
| "magenta"
|
||||
| "cyan"
|
||||
| "white"
|
||||
| "gray"
|
||||
| "grey"
|
||||
| "blackBright"
|
||||
| "redBright"
|
||||
| "greenBright"
|
||||
| "yellowBright"
|
||||
| "blueBright"
|
||||
| "magentaBright"
|
||||
| "cyanBright"
|
||||
| "whiteBright"
|
||||
| "bgBlack"
|
||||
| "bgRed"
|
||||
| "bgGreen"
|
||||
| "bgYellow"
|
||||
| "bgBlue"
|
||||
| "bgMagenta"
|
||||
| "bgCyan"
|
||||
| "bgWhite"
|
||||
| "bgBlackBright"
|
||||
| "bgRedBright"
|
||||
| "bgGreenBright"
|
||||
| "bgYellowBright"
|
||||
| "bgBlueBright"
|
||||
| "bgMagentaBright"
|
||||
| "bgCyanBright"
|
||||
| "bgWhiteBright";
|
||||
|
||||
export interface Chalk {
|
||||
(...text: string[]): string,
|
||||
(text: TemplateStringsArray, ...placeholders: mixed[]): string,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import {expectType} from 'tsd-check';
|
||||
import chalk, {Level, Chalk, ColorSupport} from '.';
|
||||
import chalk, {Level, Chalk, ColorSupport,Color} from '.';
|
||||
|
||||
// - Helpers -
|
||||
type colorReturn = Chalk & {supportsColor: ColorSupport};
|
||||
|
|
@ -15,6 +15,9 @@ expectType<boolean>(chalk.supportsColor.hasBasic);
|
|||
expectType<boolean>(chalk.supportsColor.has256);
|
||||
expectType<boolean>(chalk.supportsColor.has16m);
|
||||
|
||||
// - Color -
|
||||
expectType<Color>("red");
|
||||
|
||||
// - Chalk -
|
||||
// -- Instance --
|
||||
expectType<Chalk>(new chalk.Instance({level: 1}));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue