123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- // Imported from DefinitelyTyped project.
- // TypeScript definitions for ansi-colors
- // Definitions by: Rogier Schouten <https://github.com/rogierschouten>
- // Integrated by: Jordan Mele <https://github.com/Silic0nS0ldier>
- interface SymbolsType {
- /**
- * `undefined` on windows, `✘` on other platforms.
- */
- ballotCross?: "✘";
- ballotDisabled: "☒";
- ballotOff: "☐";
- ballotOn: "☑";
- bullet: "•";
- bulletWhite: "◦";
- /**
- * `√` on windows, `✔` on other platforms.
- */
- check: "√" | "✔";
- /**
- * `×` on windows, `✖` on other platforms.
- */
- cross: "×" | "✖";
- /**
- * `...` on windows, `⋯` on other platforms.
- */
- ellipsisLarge: "..." | "⋯";
- /**
- * `...` on windows, `…` on other platforms.
- */
- ellipsis: "..." | "…";
- fullBlock: "█";
- heart: "❤";
- identicalTo: "≡";
- info: "i" | "ℹ";
- line: "─";
- mark: "※";
- middot: "·";
- minus: "-";
- multiplication: "×";
- obelus: "÷";
- pencilDownRight: "✎";
- pencilRight: "✏";
- pencilUpRight: "✐";
- percent: "%";
- pilcrow2: "❡";
- pilcrow: "¶";
- plusMinus: "±";
- /**
- * `>` on windows, `▸` on linux, and `❯` on other platforms.
- */
- pointer: ">" | "▸" | "❯";
- /**
- * `»` on windows, `‣` on linux, and `›` on other platforms.
- */
- pointerSmall: "»" | "‣" | "›";
- question: "?";
- /**
- * `undefined` on windows, `?` on other platforms.
- */
- questionFull?: "?";
- /**
- * `?` on windows, `﹖` on other platforms.
- */
- questionSmall: "?" | "﹖";
- /**
- * `( )` on windows, `◯` on other platforms.
- */
- radioOff: "( )" | "◯";
- /**
- * `(*)` on windows, `◉` on other platforms.
- */
- radioOn: "(*)" | "◉";
- section: "§";
- starsOff: "☆";
- starsOn: "★";
- upDownArrow: "↕";
- /**
- * `‼` on windows, `⚠` on other platforms.
- */
- warning: "‼" | "⚠";
- }
- type StyleArrayStructure = [number, number];
- interface StyleArrayProperties {
- open: string;
- close: string;
- closeRe: string;
- }
- type StyleType = StyleArrayStructure & StyleArrayProperties;
- interface StylesType<T> {
- // modifiers
- reset: T;
- bold: T;
- dim: T;
- italic: T;
- underline: T;
- inverse: T;
- hidden: T;
- strikethrough: T;
- // colors
- black: T;
- red: T;
- green: T;
- yellow: T;
- blue: T;
- magenta: T;
- cyan: T;
- white: T;
- gray: T;
- grey: T;
- // bright colors
- blackBright: T;
- redBright: T;
- greenBright: T;
- yellowBright: T;
- blueBright: T;
- magentaBright: T;
- cyanBright: T;
- whiteBright: T;
- // background colors
- bgBlack: T;
- bgRed: T;
- bgGreen: T;
- bgYellow: T;
- bgBlue: T;
- bgMagenta: T;
- bgCyan: T;
- bgWhite: T;
- // bright background colors
- bgBlackBright: T;
- bgRedBright: T;
- bgGreenBright: T;
- bgYellowBright: T;
- bgBlueBright: T;
- bgMagentaBright: T;
- bgCyanBright: T;
- bgWhiteBright: T;
- }
- declare namespace ansiColors {
- interface StyleFunction extends StylesType<StyleFunction> {
- (s: string): string;
- }
- // modifiers
- const reset: StyleFunction;
- const bold: StyleFunction;
- const dim: StyleFunction;
- const italic: StyleFunction;
- const underline: StyleFunction;
- const inverse: StyleFunction;
- const hidden: StyleFunction;
- const strikethrough: StyleFunction;
- // colors
- const black: StyleFunction;
- const red: StyleFunction;
- const green: StyleFunction;
- const yellow: StyleFunction;
- const blue: StyleFunction;
- const magenta: StyleFunction;
- const cyan: StyleFunction;
- const white: StyleFunction;
- const gray: StyleFunction;
- const grey: StyleFunction;
- // bright colors
- const blackBright: StyleFunction;
- const redBright: StyleFunction;
- const greenBright: StyleFunction;
- const yellowBright: StyleFunction;
- const blueBright: StyleFunction;
- const magentaBright: StyleFunction;
- const cyanBright: StyleFunction;
- const whiteBright: StyleFunction;
- // background colors
- const bgBlack: StyleFunction;
- const bgRed: StyleFunction;
- const bgGreen: StyleFunction;
- const bgYellow: StyleFunction;
- const bgBlue: StyleFunction;
- const bgMagenta: StyleFunction;
- const bgCyan: StyleFunction;
- const bgWhite: StyleFunction;
- // bright background colors
- const bgBlackBright: StyleFunction;
- const bgRedBright: StyleFunction;
- const bgGreenBright: StyleFunction;
- const bgYellowBright: StyleFunction;
- const bgBlueBright: StyleFunction;
- const bgMagentaBright: StyleFunction;
- const bgCyanBright: StyleFunction;
- const bgWhiteBright: StyleFunction;
- let enabled: boolean;
- let visible: boolean;
- const ansiRegex: RegExp;
- /**
- * Remove styles from string
- */
- function stripColor(s: string): string;
- /**
- * Remove styles from string
- */
- function strip(s: string): string;
- /**
- * Remove styles from string
- */
- function unstyle(s: string): string;
- const styles: StylesType<StyleType>;
- const symbols: SymbolsType;
- /**
- * Outputs a string with check-symbol as prefix
- */
- function ok(...args: string[]): string;
- function create(): typeof ansiColors;
- }
- export = ansiColors;
|