index.d.ts 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. declare type CSSColor =
  2. | 'aliceblue'
  3. | 'antiquewhite'
  4. | 'aqua'
  5. | 'aquamarine'
  6. | 'azure'
  7. | 'beige'
  8. | 'bisque'
  9. | 'black'
  10. | 'blanchedalmond'
  11. | 'blue'
  12. | 'blueviolet'
  13. | 'brown'
  14. | 'burlywood'
  15. | 'cadetblue'
  16. | 'chartreuse'
  17. | 'chocolate'
  18. | 'coral'
  19. | 'cornflowerblue'
  20. | 'cornsilk'
  21. | 'crimson'
  22. | 'cyan'
  23. | 'darkblue'
  24. | 'darkcyan'
  25. | 'darkgoldenrod'
  26. | 'darkgray'
  27. | 'darkgreen'
  28. | 'darkgrey'
  29. | 'darkkhaki'
  30. | 'darkmagenta'
  31. | 'darkolivegreen'
  32. | 'darkorange'
  33. | 'darkorchid'
  34. | 'darkred'
  35. | 'darksalmon'
  36. | 'darkseagreen'
  37. | 'darkslateblue'
  38. | 'darkslategray'
  39. | 'darkslategrey'
  40. | 'darkturquoise'
  41. | 'darkviolet'
  42. | 'deeppink'
  43. | 'deepskyblue'
  44. | 'dimgray'
  45. | 'dimgrey'
  46. | 'dodgerblue'
  47. | 'firebrick'
  48. | 'floralwhite'
  49. | 'forestgreen'
  50. | 'fuchsia'
  51. | 'gainsboro'
  52. | 'ghostwhite'
  53. | 'gold'
  54. | 'goldenrod'
  55. | 'gray'
  56. | 'green'
  57. | 'greenyellow'
  58. | 'grey'
  59. | 'honeydew'
  60. | 'hotpink'
  61. | 'indianred'
  62. | 'indigo'
  63. | 'ivory'
  64. | 'khaki'
  65. | 'lavender'
  66. | 'lavenderblush'
  67. | 'lawngreen'
  68. | 'lemonchiffon'
  69. | 'lightblue'
  70. | 'lightcoral'
  71. | 'lightcyan'
  72. | 'lightgoldenrodyellow'
  73. | 'lightgray'
  74. | 'lightgreen'
  75. | 'lightgrey'
  76. | 'lightpink'
  77. | 'lightsalmon'
  78. | 'lightseagreen'
  79. | 'lightskyblue'
  80. | 'lightslategray'
  81. | 'lightslategrey'
  82. | 'lightsteelblue'
  83. | 'lightyellow'
  84. | 'lime'
  85. | 'limegreen'
  86. | 'linen'
  87. | 'magenta'
  88. | 'maroon'
  89. | 'mediumaquamarine'
  90. | 'mediumblue'
  91. | 'mediumorchid'
  92. | 'mediumpurple'
  93. | 'mediumseagreen'
  94. | 'mediumslateblue'
  95. | 'mediumspringgreen'
  96. | 'mediumturquoise'
  97. | 'mediumvioletred'
  98. | 'midnightblue'
  99. | 'mintcream'
  100. | 'mistyrose'
  101. | 'moccasin'
  102. | 'navajowhite'
  103. | 'navy'
  104. | 'oldlace'
  105. | 'olive'
  106. | 'olivedrab'
  107. | 'orange'
  108. | 'orangered'
  109. | 'orchid'
  110. | 'palegoldenrod'
  111. | 'palegreen'
  112. | 'paleturquoise'
  113. | 'palevioletred'
  114. | 'papayawhip'
  115. | 'peachpuff'
  116. | 'peru'
  117. | 'pink'
  118. | 'plum'
  119. | 'powderblue'
  120. | 'purple'
  121. | 'rebeccapurple'
  122. | 'red'
  123. | 'rosybrown'
  124. | 'royalblue'
  125. | 'saddlebrown'
  126. | 'salmon'
  127. | 'sandybrown'
  128. | 'seagreen'
  129. | 'seashell'
  130. | 'sienna'
  131. | 'silver'
  132. | 'skyblue'
  133. | 'slateblue'
  134. | 'slategray'
  135. | 'slategrey'
  136. | 'snow'
  137. | 'springgreen'
  138. | 'steelblue'
  139. | 'tan'
  140. | 'teal'
  141. | 'thistle'
  142. | 'tomato'
  143. | 'turquoise'
  144. | 'violet'
  145. | 'wheat'
  146. | 'white'
  147. | 'whitesmoke'
  148. | 'yellow'
  149. | 'yellowgreen';
  150. declare namespace ansiStyles {
  151. interface ColorConvert {
  152. /**
  153. The RGB color space.
  154. @param red - (`0`-`255`)
  155. @param green - (`0`-`255`)
  156. @param blue - (`0`-`255`)
  157. */
  158. rgb(red: number, green: number, blue: number): string;
  159. /**
  160. The RGB HEX color space.
  161. @param hex - A hexadecimal string containing RGB data.
  162. */
  163. hex(hex: string): string;
  164. /**
  165. @param keyword - A CSS color name.
  166. */
  167. keyword(keyword: CSSColor): string;
  168. /**
  169. The HSL color space.
  170. @param hue - (`0`-`360`)
  171. @param saturation - (`0`-`100`)
  172. @param lightness - (`0`-`100`)
  173. */
  174. hsl(hue: number, saturation: number, lightness: number): string;
  175. /**
  176. The HSV color space.
  177. @param hue - (`0`-`360`)
  178. @param saturation - (`0`-`100`)
  179. @param value - (`0`-`100`)
  180. */
  181. hsv(hue: number, saturation: number, value: number): string;
  182. /**
  183. The HSV color space.
  184. @param hue - (`0`-`360`)
  185. @param whiteness - (`0`-`100`)
  186. @param blackness - (`0`-`100`)
  187. */
  188. hwb(hue: number, whiteness: number, blackness: number): string;
  189. /**
  190. Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color.
  191. */
  192. ansi(ansi: number): string;
  193. /**
  194. Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
  195. */
  196. ansi256(ansi: number): string;
  197. }
  198. interface CSPair {
  199. /**
  200. The ANSI terminal control sequence for starting this style.
  201. */
  202. readonly open: string;
  203. /**
  204. The ANSI terminal control sequence for ending this style.
  205. */
  206. readonly close: string;
  207. }
  208. interface ColorBase {
  209. readonly ansi: ColorConvert;
  210. readonly ansi256: ColorConvert;
  211. readonly ansi16m: ColorConvert;
  212. /**
  213. The ANSI terminal control sequence for ending this color.
  214. */
  215. readonly close: string;
  216. }
  217. interface Modifier {
  218. /**
  219. Resets the current color chain.
  220. */
  221. readonly reset: CSPair;
  222. /**
  223. Make text bold.
  224. */
  225. readonly bold: CSPair;
  226. /**
  227. Emitting only a small amount of light.
  228. */
  229. readonly dim: CSPair;
  230. /**
  231. Make text italic. (Not widely supported)
  232. */
  233. readonly italic: CSPair;
  234. /**
  235. Make text underline. (Not widely supported)
  236. */
  237. readonly underline: CSPair;
  238. /**
  239. Inverse background and foreground colors.
  240. */
  241. readonly inverse: CSPair;
  242. /**
  243. Prints the text, but makes it invisible.
  244. */
  245. readonly hidden: CSPair;
  246. /**
  247. Puts a horizontal line through the center of the text. (Not widely supported)
  248. */
  249. readonly strikethrough: CSPair;
  250. }
  251. interface ForegroundColor {
  252. readonly black: CSPair;
  253. readonly red: CSPair;
  254. readonly green: CSPair;
  255. readonly yellow: CSPair;
  256. readonly blue: CSPair;
  257. readonly cyan: CSPair;
  258. readonly magenta: CSPair;
  259. readonly white: CSPair;
  260. /**
  261. Alias for `blackBright`.
  262. */
  263. readonly gray: CSPair;
  264. /**
  265. Alias for `blackBright`.
  266. */
  267. readonly grey: CSPair;
  268. readonly blackBright: CSPair;
  269. readonly redBright: CSPair;
  270. readonly greenBright: CSPair;
  271. readonly yellowBright: CSPair;
  272. readonly blueBright: CSPair;
  273. readonly cyanBright: CSPair;
  274. readonly magentaBright: CSPair;
  275. readonly whiteBright: CSPair;
  276. }
  277. interface BackgroundColor {
  278. readonly bgBlack: CSPair;
  279. readonly bgRed: CSPair;
  280. readonly bgGreen: CSPair;
  281. readonly bgYellow: CSPair;
  282. readonly bgBlue: CSPair;
  283. readonly bgCyan: CSPair;
  284. readonly bgMagenta: CSPair;
  285. readonly bgWhite: CSPair;
  286. /**
  287. Alias for `bgBlackBright`.
  288. */
  289. readonly bgGray: CSPair;
  290. /**
  291. Alias for `bgBlackBright`.
  292. */
  293. readonly bgGrey: CSPair;
  294. readonly bgBlackBright: CSPair;
  295. readonly bgRedBright: CSPair;
  296. readonly bgGreenBright: CSPair;
  297. readonly bgYellowBright: CSPair;
  298. readonly bgBlueBright: CSPair;
  299. readonly bgCyanBright: CSPair;
  300. readonly bgMagentaBright: CSPair;
  301. readonly bgWhiteBright: CSPair;
  302. }
  303. }
  304. declare const ansiStyles: {
  305. readonly modifier: ansiStyles.Modifier;
  306. readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase;
  307. readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase;
  308. readonly codes: ReadonlyMap<number, number>;
  309. } & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier;
  310. export = ansiStyles;