kleur.d.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // TypeScript definitions for kleur
  2. // Definitions by: Madhav Varshney <https://github.com/madhavarshney>
  3. // Originally written for ansi-colors
  4. // Originally by: Rogier Schouten <https://github.com/rogierschouten>
  5. /**
  6. * Each method can be called as a function
  7. * or return a chainable Kleur object
  8. */
  9. interface KleurOrFunction extends KleurInstance {
  10. (string: string): string;
  11. }
  12. interface KleurInstance {
  13. /* Colors */
  14. black: KleurOrFunction;
  15. red: KleurOrFunction;
  16. green: KleurOrFunction;
  17. yellow: KleurOrFunction;
  18. blue: KleurOrFunction;
  19. magenta: KleurOrFunction;
  20. cyan: KleurOrFunction;
  21. white: KleurOrFunction;
  22. gray: KleurOrFunction;
  23. /* Background Colors */
  24. bgBlack: KleurOrFunction;
  25. bgRed: KleurOrFunction;
  26. bgGreen: KleurOrFunction;
  27. bgYellow: KleurOrFunction;
  28. bgBlue: KleurOrFunction;
  29. bgMagenta: KleurOrFunction;
  30. bgCyan: KleurOrFunction;
  31. bgWhite: KleurOrFunction;
  32. /* Modifiers */
  33. reset: KleurOrFunction;
  34. bold: KleurOrFunction;
  35. dim: KleurOrFunction;
  36. italic: KleurOrFunction;
  37. underline: KleurOrFunction;
  38. inverse: KleurOrFunction;
  39. hidden: KleurOrFunction;
  40. strikethrough: KleurOrFunction;
  41. }
  42. declare let kleur: KleurInstance;
  43. export default kleur;
  44. /**
  45. * Enable ANSI Colors.
  46. * Note: You cannot write to ES6 exports and therefore to `kleur.enabled`
  47. * in TypeScript with `import * as kleur from 'kleur';`.
  48. * Workaround is to use `import kleur = require('kleur');`.
  49. */
  50. export let enabled: boolean;