1 | // Imported from DefinitelyTyped project.
|
---|
2 | // TypeScript definitions for ansi-colors
|
---|
3 | // Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
---|
4 | // Integrated by: Jordan Mele <https://github.com/Silic0nS0ldier>
|
---|
5 |
|
---|
6 | interface SymbolsType {
|
---|
7 | check: string;
|
---|
8 | cross: string;
|
---|
9 | info: string;
|
---|
10 | line: string;
|
---|
11 | pointer: string;
|
---|
12 | pointerSmall: string;
|
---|
13 | question: string;
|
---|
14 | warning: string;
|
---|
15 | }
|
---|
16 |
|
---|
17 | type StyleArrayStructure = [number, number];
|
---|
18 | interface StyleArrayProperties {
|
---|
19 | open: string;
|
---|
20 | close: string;
|
---|
21 | closeRe: string;
|
---|
22 | }
|
---|
23 |
|
---|
24 | type StyleType = StyleArrayStructure & StyleArrayProperties;
|
---|
25 |
|
---|
26 | export interface StyleFunction extends StylesType<StyleFunction> {
|
---|
27 | (s: string): string;
|
---|
28 | }
|
---|
29 |
|
---|
30 | interface StylesType<T> {
|
---|
31 | // modifiers
|
---|
32 | reset: T;
|
---|
33 | bold: T;
|
---|
34 | dim: T;
|
---|
35 | italic: T;
|
---|
36 | underline: T;
|
---|
37 | inverse: T;
|
---|
38 | hidden: T;
|
---|
39 | strikethrough: T;
|
---|
40 |
|
---|
41 | // colors
|
---|
42 | black: T;
|
---|
43 | red: T;
|
---|
44 | green: T;
|
---|
45 | yellow: T;
|
---|
46 | blue: T;
|
---|
47 | magenta: T;
|
---|
48 | cyan: T;
|
---|
49 | white: T;
|
---|
50 | gray: T;
|
---|
51 | grey: T;
|
---|
52 |
|
---|
53 | // bright colors
|
---|
54 | blackBright: T;
|
---|
55 | redBright: T;
|
---|
56 | greenBright: T;
|
---|
57 | yellowBright: T;
|
---|
58 | blueBright: T;
|
---|
59 | magentaBright: T;
|
---|
60 | cyanBright: T;
|
---|
61 | whiteBright: T;
|
---|
62 |
|
---|
63 | // background colors
|
---|
64 | bgBlack: T;
|
---|
65 | bgRed: T;
|
---|
66 | bgGreen: T;
|
---|
67 | bgYellow: T;
|
---|
68 | bgBlue: T;
|
---|
69 | bgMagenta: T;
|
---|
70 | bgCyan: T;
|
---|
71 | bgWhite: T;
|
---|
72 |
|
---|
73 | // bright background colors
|
---|
74 | bgBlackBright: T;
|
---|
75 | bgRedBright: T;
|
---|
76 | bgGreenBright: T;
|
---|
77 | bgYellowBright: T;
|
---|
78 | bgBlueBright: T;
|
---|
79 | bgMagentaBright: T;
|
---|
80 | bgCyanBright: T;
|
---|
81 | bgWhiteBright: T;
|
---|
82 | }
|
---|
83 |
|
---|
84 | // modifiers
|
---|
85 | export const reset: StyleFunction;
|
---|
86 | export const bold: StyleFunction;
|
---|
87 | export const dim: StyleFunction;
|
---|
88 | export const italic: StyleFunction;
|
---|
89 | export const underline: StyleFunction;
|
---|
90 | export const inverse: StyleFunction;
|
---|
91 | export const hidden: StyleFunction;
|
---|
92 | export const strikethrough: StyleFunction;
|
---|
93 |
|
---|
94 | // colors
|
---|
95 | export const black: StyleFunction;
|
---|
96 | export const red: StyleFunction;
|
---|
97 | export const green: StyleFunction;
|
---|
98 | export const yellow: StyleFunction;
|
---|
99 | export const blue: StyleFunction;
|
---|
100 | export const magenta: StyleFunction;
|
---|
101 | export const cyan: StyleFunction;
|
---|
102 | export const white: StyleFunction;
|
---|
103 | export const gray: StyleFunction;
|
---|
104 | export const grey: StyleFunction;
|
---|
105 |
|
---|
106 | // bright colors
|
---|
107 | export const blackBright: StyleFunction;
|
---|
108 | export const redBright: StyleFunction;
|
---|
109 | export const greenBright: StyleFunction;
|
---|
110 | export const yellowBright: StyleFunction;
|
---|
111 | export const blueBright: StyleFunction;
|
---|
112 | export const magentaBright: StyleFunction;
|
---|
113 | export const cyanBright: StyleFunction;
|
---|
114 | export const whiteBright: StyleFunction;
|
---|
115 |
|
---|
116 | // background colors
|
---|
117 | export const bgBlack: StyleFunction;
|
---|
118 | export const bgRed: StyleFunction;
|
---|
119 | export const bgGreen: StyleFunction;
|
---|
120 | export const bgYellow: StyleFunction;
|
---|
121 | export const bgBlue: StyleFunction;
|
---|
122 | export const bgMagenta: StyleFunction;
|
---|
123 | export const bgCyan: StyleFunction;
|
---|
124 | export const bgWhite: StyleFunction;
|
---|
125 |
|
---|
126 | // bright background colors
|
---|
127 | export const bgBlackBright: StyleFunction;
|
---|
128 | export const bgRedBright: StyleFunction;
|
---|
129 | export const bgGreenBright: StyleFunction;
|
---|
130 | export const bgYellowBright: StyleFunction;
|
---|
131 | export const bgBlueBright: StyleFunction;
|
---|
132 | export const bgMagentaBright: StyleFunction;
|
---|
133 | export const bgCyanBright: StyleFunction;
|
---|
134 | export const bgWhiteBright: StyleFunction;
|
---|
135 |
|
---|
136 | export let enabled: boolean;
|
---|
137 | export let visible: boolean;
|
---|
138 | export const ansiRegex: RegExp;
|
---|
139 |
|
---|
140 | /**
|
---|
141 | * Remove styles from string
|
---|
142 | */
|
---|
143 | export function stripColor(s: string): string;
|
---|
144 |
|
---|
145 | /**
|
---|
146 | * Remove styles from string
|
---|
147 | */
|
---|
148 | export function strip(s: string): string;
|
---|
149 |
|
---|
150 | /**
|
---|
151 | * Remove styles from string
|
---|
152 | */
|
---|
153 | export function unstyle(s: string): string;
|
---|
154 |
|
---|
155 | export const styles: StylesType<StyleType>;
|
---|
156 | export const symbols: SymbolsType;
|
---|
157 |
|
---|
158 | /**
|
---|
159 | * Outputs a string with check-symbol as prefix
|
---|
160 | */
|
---|
161 | export function ok(...args: string[]): string;
|
---|