styles.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. "use strict";
  2. // Generated by CoffeeScript 2.5.1
  3. var codes, styles;
  4. module.exports = styles = {};
  5. styles.codes = codes = {
  6. 'none': 0,
  7. 'black': 30,
  8. 'red': 31,
  9. 'green': 32,
  10. 'yellow': 33,
  11. 'blue': 34,
  12. 'magenta': 35,
  13. 'cyan': 36,
  14. 'white': 37,
  15. 'grey': 90,
  16. 'bright-red': 91,
  17. 'bright-green': 92,
  18. 'bright-yellow': 93,
  19. 'bright-blue': 94,
  20. 'bright-magenta': 95,
  21. 'bright-cyan': 96,
  22. 'bright-white': 97,
  23. 'bg-black': 40,
  24. 'bg-red': 41,
  25. 'bg-green': 42,
  26. 'bg-yellow': 43,
  27. 'bg-blue': 44,
  28. 'bg-magenta': 45,
  29. 'bg-cyan': 46,
  30. 'bg-white': 47,
  31. 'bg-grey': 100,
  32. 'bg-bright-red': 101,
  33. 'bg-bright-green': 102,
  34. 'bg-bright-yellow': 103,
  35. 'bg-bright-blue': 104,
  36. 'bg-bright-magenta': 105,
  37. 'bg-bright-cyan': 106,
  38. 'bg-bright-white': 107
  39. };
  40. styles.color = function (str) {
  41. var code;
  42. if (str === 'none') {
  43. return '';
  44. }
  45. code = codes[str];
  46. if (code == null) {
  47. throw Error("Unknown color `".concat(str, "`"));
  48. }
  49. return "\x1b[" + code + "m";
  50. };
  51. styles.bg = function (str) {
  52. var code;
  53. if (str === 'none') {
  54. return '';
  55. }
  56. code = codes['bg-' + str];
  57. if (code == null) {
  58. throw Error("Unknown bg color `".concat(str, "`"));
  59. }
  60. return "\x1B[" + code + "m";
  61. };
  62. styles.none = function (str) {
  63. return "\x1B[" + codes.none + "m";
  64. };