1
0

index.js.flow 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // @flow strict
  2. type TemplateStringsArray = $ReadOnlyArray<string>;
  3. export type Level = $Values<{
  4. None: 0,
  5. Basic: 1,
  6. Ansi256: 2,
  7. TrueColor: 3
  8. }>;
  9. export type ChalkOptions = {|
  10. enabled?: boolean,
  11. level?: Level
  12. |};
  13. export type ColorSupport = {|
  14. level: Level,
  15. hasBasic: boolean,
  16. has256: boolean,
  17. has16m: boolean
  18. |};
  19. export interface Chalk {
  20. (...text: string[]): string,
  21. (text: TemplateStringsArray, ...placeholders: string[]): string,
  22. constructor(options?: ChalkOptions): Chalk,
  23. enabled: boolean,
  24. level: Level,
  25. rgb(r: number, g: number, b: number): Chalk,
  26. hsl(h: number, s: number, l: number): Chalk,
  27. hsv(h: number, s: number, v: number): Chalk,
  28. hwb(h: number, w: number, b: number): Chalk,
  29. bgHex(color: string): Chalk,
  30. bgKeyword(color: string): Chalk,
  31. bgRgb(r: number, g: number, b: number): Chalk,
  32. bgHsl(h: number, s: number, l: number): Chalk,
  33. bgHsv(h: number, s: number, v: number): Chalk,
  34. bgHwb(h: number, w: number, b: number): Chalk,
  35. hex(color: string): Chalk,
  36. keyword(color: string): Chalk,
  37. +reset: Chalk,
  38. +bold: Chalk,
  39. +dim: Chalk,
  40. +italic: Chalk,
  41. +underline: Chalk,
  42. +inverse: Chalk,
  43. +hidden: Chalk,
  44. +strikethrough: Chalk,
  45. +visible: Chalk,
  46. +black: Chalk,
  47. +red: Chalk,
  48. +green: Chalk,
  49. +yellow: Chalk,
  50. +blue: Chalk,
  51. +magenta: Chalk,
  52. +cyan: Chalk,
  53. +white: Chalk,
  54. +gray: Chalk,
  55. +grey: Chalk,
  56. +blackBright: Chalk,
  57. +redBright: Chalk,
  58. +greenBright: Chalk,
  59. +yellowBright: Chalk,
  60. +blueBright: Chalk,
  61. +magentaBright: Chalk,
  62. +cyanBright: Chalk,
  63. +whiteBright: Chalk,
  64. +bgBlack: Chalk,
  65. +bgRed: Chalk,
  66. +bgGreen: Chalk,
  67. +bgYellow: Chalk,
  68. +bgBlue: Chalk,
  69. +bgMagenta: Chalk,
  70. +bgCyan: Chalk,
  71. +bgWhite: Chalk,
  72. +bgBlackBright: Chalk,
  73. +bgRedBright: Chalk,
  74. +bgGreenBright: Chalk,
  75. +bgYellowBright: Chalk,
  76. +bgBlueBright: Chalk,
  77. +bgMagentaBright: Chalk,
  78. +bgCyanBright: Chalk,
  79. +bgWhiteBrigh: Chalk,
  80. supportsColor: ColorSupport
  81. };
  82. declare module.exports: Chalk;