File: index.d.cts

package info (click to toggle)
node-chalk 5.6.2%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 620 kB
  • sloc: javascript: 487; makefile: 10; sh: 2
file content (197 lines) | stat: -rw-r--r-- 4,712 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
// chalk.d.cts

import type {
    ModifierName,
    ForegroundColorName,
    BackgroundColorName,
    ColorName,
    modifierNames,
    foregroundColorNames,
    backgroundColorNames,
    colorNames,
} from 'ansi-styles';

import type {
    ColorInfo,
    ColorSupport,
    ColorSupportLevel,
} from 'supports-color';

declare const chalk: chalk.ChalkInstance;

declare namespace chalk {
    interface Options {
        /**
        Specify the color support for Chalk.

        By default, color support is automatically detected based on the environment.

        Levels:
        - `0` - All colors disabled.
        - `1` - Basic 16 colors support.
        - `2` - ANSI 256 colors support.
        - `3` - Truecolor 16 million colors support.
        */
        readonly level?: ColorSupportLevel;
    }

    /**
    Return a new Chalk instance.
    */
    const Chalk: new (options?: Options) => ChalkInstance; // eslint-disable-line @typescript-eslint/naming-convention

    interface ChalkInstance {
        (...text: unknown[]): string;

        /**
        The color support for Chalk.
        */
        level: ColorSupportLevel;

        rgb(red: number, green: number, blue: number): this;
        hex(color: string): this;
        ansi256(index: number): this;

        bgRgb(red: number, green: number, blue: number): this;
        bgHex(color: string): this;
        bgAnsi256(index: number): this;

        readonly reset: this;
        readonly bold: this;
        readonly dim: this;
        readonly italic: this;
        readonly underline: this;
        readonly overline: this;
        readonly inverse: this;
        readonly hidden: this;
        readonly strikethrough: this;
        readonly visible: this;

        readonly black: this;
        readonly red: this;
        readonly green: this;
        readonly yellow: this;
        readonly blue: this;
        readonly magenta: this;
        readonly cyan: this;
        readonly white: this;

        /*
        Alias for `blackBright`.
        */
        readonly gray: this;

        /*
        Alias for `blackBright`.
        */
        readonly grey: this;

        readonly blackBright: this;
        readonly redBright: this;
        readonly greenBright: this;
        readonly yellowBright: this;
        readonly blueBright: this;
        readonly magentaBright: this;
        readonly cyanBright: this;
        readonly whiteBright: this;

        readonly bgBlack: this;
        readonly bgRed: this;
        readonly bgGreen: this;
        readonly bgYellow: this;
        readonly bgBlue: this;
        readonly bgMagenta: this;
        readonly bgCyan: this;
        readonly bgWhite: this;

        /*
        Alias for `bgBlackBright`.
        */
        readonly bgGray: this;

        /*
        Alias for `bgBlackBright`.
        */
        readonly bgGrey: this;

        readonly bgBlackBright: this;
        readonly bgRedBright: this;
        readonly bgGreenBright: this;
        readonly bgYellowBright: this;
        readonly bgBlueBright: this;
        readonly bgMagentaBright: this;
        readonly bgCyanBright: this;
        readonly bgWhiteBright: this;
    }

    /**
    Main Chalk object that allows to chain styles together.
    */

    const supportsColor: ColorInfo;
    const chalkStderr: ChalkInstance;
    const supportsColorStderr: ColorInfo;

    // Re‑exported types/values from ansi-styles
    export {
        ModifierName,
        ForegroundColorName,
        BackgroundColorName,
        ColorName,
        modifierNames,
        foregroundColorNames,
        backgroundColorNames,
        colorNames,
    };

    // Re‑exported types from supports-color
    export {
        ColorInfo,
        ColorSupport,
        ColorSupportLevel,
    };

    // TODO: Remove these aliases in the next major version

    /**
    @deprecated Use `ModifierName` instead.
    */
    type Modifiers = ModifierName;

    /**
    @deprecated Use `ForegroundColorName` instead.
    */
    type ForegroundColor = ForegroundColorName;

    /**
    @deprecated Use `BackgroundColorName` instead.
    */
    type BackgroundColor = BackgroundColorName;

    /**
    @deprecated Use `ColorName` instead.
    */
    type Color = ColorName;

    /**
    @deprecated Use `modifierNames` instead.
    */
    const modifiers: readonly Modifiers[];

    /**
    @deprecated Use `foregroundColorNames` instead.
    */
    const foregroundColors: readonly ForegroundColor[];

    /**
    @deprecated Use `backgroundColorNames` instead.
    */
    const backgroundColors: readonly BackgroundColor[];

    /**
    @deprecated Use `colorNames` instead.
    */
    const colors: readonly Color[];
}

export = chalk;