2a849a45b34c20c580748e438b7e481dfedc33286f25cff9d4ed90445e223e9d95e1857a0475a13e64c18c1b99e53d3b079ee5a927fa44357fb111502f5324 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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. interface SymbolsType {
  6. /**
  7. * `undefined` on windows, `✘` on other platforms.
  8. */
  9. ballotCross?: "✘";
  10. ballotDisabled: "☒";
  11. ballotOff: "☐";
  12. ballotOn: "☑";
  13. bullet: "•";
  14. bulletWhite: "◦";
  15. /**
  16. * `√` on windows, `✔` on other platforms.
  17. */
  18. check: "√" | "✔";
  19. /**
  20. * `×` on windows, `✖` on other platforms.
  21. */
  22. cross: "×" | "✖";
  23. /**
  24. * `...` on windows, `⋯` on other platforms.
  25. */
  26. ellipsisLarge: "..." | "⋯";
  27. /**
  28. * `...` on windows, `…` on other platforms.
  29. */
  30. ellipsis: "..." | "…";
  31. fullBlock: "█";
  32. heart: "❤";
  33. identicalTo: "≡";
  34. info: "i" | "ℹ";
  35. line: "─";
  36. mark: "※";
  37. middot: "·";
  38. minus: "-";
  39. multiplication: "×";
  40. obelus: "÷";
  41. pencilDownRight: "✎";
  42. pencilRight: "✏";
  43. pencilUpRight: "✐";
  44. percent: "%";
  45. pilcrow2: "❡";
  46. pilcrow: "¶";
  47. plusMinus: "±";
  48. /**
  49. * `>` on windows, `▸` on linux, and `❯` on other platforms.
  50. */
  51. pointer: ">" | "▸" | "❯";
  52. /**
  53. * `»` on windows, `‣` on linux, and `›` on other platforms.
  54. */
  55. pointerSmall: "»" | "‣" | "›";
  56. question: "?";
  57. /**
  58. * `undefined` on windows, `?` on other platforms.
  59. */
  60. questionFull?: "?";
  61. /**
  62. * `?` on windows, `﹖` on other platforms.
  63. */
  64. questionSmall: "?" | "﹖";
  65. /**
  66. * `( )` on windows, `◯` on other platforms.
  67. */
  68. radioOff: "( )" | "◯";
  69. /**
  70. * `(*)` on windows, `◉` on other platforms.
  71. */
  72. radioOn: "(*)" | "◉";
  73. section: "§";
  74. starsOff: "☆";
  75. starsOn: "★";
  76. upDownArrow: "↕";
  77. /**
  78. * `‼` on windows, `⚠` on other platforms.
  79. */
  80. warning: "‼" | "⚠";
  81. }
  82. type StyleArrayStructure = [number, number];
  83. interface StyleArrayProperties {
  84. open: string;
  85. close: string;
  86. closeRe: string;
  87. }
  88. type StyleType = StyleArrayStructure & StyleArrayProperties;
  89. interface StylesType<T> {
  90. // modifiers
  91. reset: T;
  92. bold: T;
  93. dim: T;
  94. italic: T;
  95. underline: T;
  96. inverse: T;
  97. hidden: T;
  98. strikethrough: T;
  99. // colors
  100. black: T;
  101. red: T;
  102. green: T;
  103. yellow: T;
  104. blue: T;
  105. magenta: T;
  106. cyan: T;
  107. white: T;
  108. gray: T;
  109. grey: T;
  110. // bright colors
  111. blackBright: T;
  112. redBright: T;
  113. greenBright: T;
  114. yellowBright: T;
  115. blueBright: T;
  116. magentaBright: T;
  117. cyanBright: T;
  118. whiteBright: T;
  119. // background colors
  120. bgBlack: T;
  121. bgRed: T;
  122. bgGreen: T;
  123. bgYellow: T;
  124. bgBlue: T;
  125. bgMagenta: T;
  126. bgCyan: T;
  127. bgWhite: T;
  128. // bright background colors
  129. bgBlackBright: T;
  130. bgRedBright: T;
  131. bgGreenBright: T;
  132. bgYellowBright: T;
  133. bgBlueBright: T;
  134. bgMagentaBright: T;
  135. bgCyanBright: T;
  136. bgWhiteBright: T;
  137. }
  138. declare namespace ansiColors {
  139. interface StyleFunction extends StylesType<StyleFunction> {
  140. (s: string): string;
  141. }
  142. // modifiers
  143. const reset: StyleFunction;
  144. const bold: StyleFunction;
  145. const dim: StyleFunction;
  146. const italic: StyleFunction;
  147. const underline: StyleFunction;
  148. const inverse: StyleFunction;
  149. const hidden: StyleFunction;
  150. const strikethrough: StyleFunction;
  151. // colors
  152. const black: StyleFunction;
  153. const red: StyleFunction;
  154. const green: StyleFunction;
  155. const yellow: StyleFunction;
  156. const blue: StyleFunction;
  157. const magenta: StyleFunction;
  158. const cyan: StyleFunction;
  159. const white: StyleFunction;
  160. const gray: StyleFunction;
  161. const grey: StyleFunction;
  162. // bright colors
  163. const blackBright: StyleFunction;
  164. const redBright: StyleFunction;
  165. const greenBright: StyleFunction;
  166. const yellowBright: StyleFunction;
  167. const blueBright: StyleFunction;
  168. const magentaBright: StyleFunction;
  169. const cyanBright: StyleFunction;
  170. const whiteBright: StyleFunction;
  171. // background colors
  172. const bgBlack: StyleFunction;
  173. const bgRed: StyleFunction;
  174. const bgGreen: StyleFunction;
  175. const bgYellow: StyleFunction;
  176. const bgBlue: StyleFunction;
  177. const bgMagenta: StyleFunction;
  178. const bgCyan: StyleFunction;
  179. const bgWhite: StyleFunction;
  180. // bright background colors
  181. const bgBlackBright: StyleFunction;
  182. const bgRedBright: StyleFunction;
  183. const bgGreenBright: StyleFunction;
  184. const bgYellowBright: StyleFunction;
  185. const bgBlueBright: StyleFunction;
  186. const bgMagentaBright: StyleFunction;
  187. const bgCyanBright: StyleFunction;
  188. const bgWhiteBright: StyleFunction;
  189. let enabled: boolean;
  190. let visible: boolean;
  191. const ansiRegex: RegExp;
  192. /**
  193. * Remove styles from string
  194. */
  195. function stripColor(s: string): string;
  196. /**
  197. * Remove styles from string
  198. */
  199. function strip(s: string): string;
  200. /**
  201. * Remove styles from string
  202. */
  203. function unstyle(s: string): string;
  204. const styles: StylesType<StyleType>;
  205. const symbols: SymbolsType;
  206. /**
  207. * Outputs a string with check-symbol as prefix
  208. */
  209. function ok(...args: string[]): string;
  210. function create(): typeof ansiColors;
  211. }
  212. export = ansiColors;