Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. import * as cssColors from 'color-name';
  2. declare namespace ansiStyles {
  3. interface ColorConvert {
  4. /**
  5. The RGB color space.
  6. @param red - (`0`-`255`)
  7. @param green - (`0`-`255`)
  8. @param blue - (`0`-`255`)
  9. */
  10. rgb(red: number, green: number, blue: number): string;
  11. /**
  12. The RGB HEX color space.
  13. @param hex - A hexadecimal string containing RGB data.
  14. */
  15. hex(hex: string): string;
  16. /**
  17. @param keyword - A CSS color name.
  18. */
  19. keyword(keyword: keyof typeof cssColors): string;
  20. /**
  21. The HSL color space.
  22. @param hue - (`0`-`360`)
  23. @param saturation - (`0`-`100`)
  24. @param lightness - (`0`-`100`)
  25. */
  26. hsl(hue: number, saturation: number, lightness: number): string;
  27. /**
  28. The HSV color space.
  29. @param hue - (`0`-`360`)
  30. @param saturation - (`0`-`100`)
  31. @param value - (`0`-`100`)
  32. */
  33. hsv(hue: number, saturation: number, value: number): string;
  34. /**
  35. The HSV color space.
  36. @param hue - (`0`-`360`)
  37. @param whiteness - (`0`-`100`)
  38. @param blackness - (`0`-`100`)
  39. */
  40. hwb(hue: number, whiteness: number, blackness: number): string;
  41. /**
  42. Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color.
  43. */
  44. ansi(ansi: number): string;
  45. /**
  46. Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
  47. */
  48. ansi256(ansi: number): string;
  49. }
  50. interface CSPair {
  51. /**
  52. The ANSI terminal control sequence for starting this style.
  53. */
  54. readonly open: string;
  55. /**
  56. The ANSI terminal control sequence for ending this style.
  57. */
  58. readonly close: string;
  59. }
  60. interface ColorBase {
  61. readonly ansi: ColorConvert;
  62. readonly ansi256: ColorConvert;
  63. readonly ansi16m: ColorConvert;
  64. /**
  65. The ANSI terminal control sequence for ending this color.
  66. */
  67. readonly close: string;
  68. }
  69. interface Modifier {
  70. /**
  71. Resets the current color chain.
  72. */
  73. readonly reset: CSPair;
  74. /**
  75. Make text bold.
  76. */
  77. readonly bold: CSPair;
  78. /**
  79. Emitting only a small amount of light.
  80. */
  81. readonly dim: CSPair;
  82. /**
  83. Make text italic. (Not widely supported)
  84. */
  85. readonly italic: CSPair;
  86. /**
  87. Make text underline. (Not widely supported)
  88. */
  89. readonly underline: CSPair;
  90. /**
  91. Inverse background and foreground colors.
  92. */
  93. readonly inverse: CSPair;
  94. /**
  95. Prints the text, but makes it invisible.
  96. */
  97. readonly hidden: CSPair;
  98. /**
  99. Puts a horizontal line through the center of the text. (Not widely supported)
  100. */
  101. readonly strikethrough: CSPair;
  102. }
  103. interface ForegroundColor {
  104. readonly black: CSPair;
  105. readonly red: CSPair;
  106. readonly green: CSPair;
  107. readonly yellow: CSPair;
  108. readonly blue: CSPair;
  109. readonly cyan: CSPair;
  110. readonly magenta: CSPair;
  111. readonly white: CSPair;
  112. /**
  113. Alias for `blackBright`.
  114. */
  115. readonly gray: CSPair;
  116. /**
  117. Alias for `blackBright`.
  118. */
  119. readonly grey: CSPair;
  120. readonly blackBright: CSPair;
  121. readonly redBright: CSPair;
  122. readonly greenBright: CSPair;
  123. readonly yellowBright: CSPair;
  124. readonly blueBright: CSPair;
  125. readonly cyanBright: CSPair;
  126. readonly magentaBright: CSPair;
  127. readonly whiteBright: CSPair;
  128. }
  129. interface BackgroundColor {
  130. readonly bgBlack: CSPair;
  131. readonly bgRed: CSPair;
  132. readonly bgGreen: CSPair;
  133. readonly bgYellow: CSPair;
  134. readonly bgBlue: CSPair;
  135. readonly bgCyan: CSPair;
  136. readonly bgMagenta: CSPair;
  137. readonly bgWhite: CSPair;
  138. /**
  139. Alias for `bgBlackBright`.
  140. */
  141. readonly bgGray: CSPair;
  142. /**
  143. Alias for `bgBlackBright`.
  144. */
  145. readonly bgGrey: CSPair;
  146. readonly bgBlackBright: CSPair;
  147. readonly bgRedBright: CSPair;
  148. readonly bgGreenBright: CSPair;
  149. readonly bgYellowBright: CSPair;
  150. readonly bgBlueBright: CSPair;
  151. readonly bgCyanBright: CSPair;
  152. readonly bgMagentaBright: CSPair;
  153. readonly bgWhiteBright: CSPair;
  154. }
  155. }
  156. declare const ansiStyles: {
  157. readonly modifier: ansiStyles.Modifier;
  158. readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase;
  159. readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase;
  160. readonly codes: ReadonlyMap<number, number>;
  161. } & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier;
  162. export = ansiStyles;