index.js.flow 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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;