Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <div align="center">
  2. <img src="shots/logo.png" alt="kleur" height="120" />
  3. </div>
  4. <div align="center">
  5. <a href="https://npmjs.org/package/kleur">
  6. <img src="https://badgen.now.sh/npm/v/kleur" alt="version" />
  7. </a>
  8. <a href="https://travis-ci.org/lukeed/kleur">
  9. <img src="https://badgen.now.sh/travis/lukeed/kleur" alt="travis" />
  10. </a>
  11. <a href="https://npmjs.org/package/kleur">
  12. <img src="https://badgen.now.sh/npm/dm/kleur" alt="downloads" />
  13. </a>
  14. <a href="https://packagephobia.now.sh/result?p=kleur">
  15. <img src="https://packagephobia.now.sh/badge?p=kleur" alt="install size" />
  16. </a>
  17. </div>
  18. <div align="center">The fastest Node.js library for formatting terminal text with ANSI colors~!</div>
  19. ## Features
  20. * No dependencies
  21. * Super [lightweight](#load-time) & [performant](#performance)
  22. * Supports [nested](#nested-methods) & [chained](#chained-methods) colors
  23. * No `String.prototype` modifications
  24. * Conditional [color support](#conditional-support)
  25. * Familiar [API](#api)
  26. ---
  27. As of `v3.0` the Chalk-style syntax (magical getter) is no longer used.<br>If you need or require that syntax, consider using [`ansi-colors`](https://github.com/doowb/ansi-colors), which maintains `chalk` parity.
  28. ---
  29. ## Install
  30. ```
  31. $ npm install --save kleur
  32. ```
  33. ## Usage
  34. ```js
  35. const { red, white, blue, bold } = require('kleur');
  36. // basic usage
  37. red('red text');
  38. // chained methods
  39. blue().bold().underline('howdy partner');
  40. // nested methods
  41. bold(`${ white().bgRed('[ERROR]') } ${ red().italic('Something happened')}`);
  42. ```
  43. ### Chained Methods
  44. ```js
  45. console.log(bold().red('this is a bold red message'));
  46. console.log(bold().italic('this is a bold italicized message'));
  47. console.log(bold().yellow().bgRed().italic('this is a bold yellow italicized message'));
  48. console.log(green().bold().underline('this is a bold green underlined message'));
  49. ```
  50. <img src="shots/1.png" width="300" />
  51. ### Nested Methods
  52. ```js
  53. const { yellow, red, cyan } = require('kleur');
  54. console.log(yellow(`foo ${red().bold('red')} bar ${cyan('cyan')} baz`));
  55. console.log(yellow('foo ' + red().bold('red') + ' bar ' + cyan('cyan') + ' baz'));
  56. ```
  57. <img src="shots/2.png" width="300" />
  58. ### Conditional Support
  59. Toggle color support as needed; `kleur` includes simple auto-detection which may not cover all cases.
  60. ```js
  61. const kleur = require('kleur');
  62. // manually disable
  63. kleur.enabled = false;
  64. // or use another library to detect support
  65. kleur.enabled = require('color-support').level;
  66. console.log(kleur.red('I will only be colored red if the terminal supports colors'));
  67. ```
  68. ## API
  69. Any `kleur` method returns a `String` when invoked with input; otherwise chaining is expected.
  70. > It's up to the developer to pass the output to destinations like `console.log`, `process.stdout.write`, etc.
  71. The methods below are grouped by type for legibility purposes only. They each can be [chained](#chained-methods) or [nested](#nested-methods) with one another.
  72. ***Colors:***
  73. > black &mdash; red &mdash; green &mdash; yellow &mdash; blue &mdash; magenta &mdash; cyan &mdash; white &mdash; gray &mdash; grey
  74. ***Backgrounds:***
  75. > bgBlack &mdash; bgRed &mdash; bgGreen &mdash; bgYellow &mdash; bgBlue &mdash; bgMagenta &mdash; bgCyan &mdash; bgWhite
  76. ***Modifiers:***
  77. > reset &mdash; bold &mdash; dim &mdash; italic* &mdash; underline &mdash; inverse &mdash; hidden &mdash; strikethrough*
  78. <sup>* <em>Not widely supported</em></sup>
  79. ## Benchmarks
  80. > Using Node v10.13.0
  81. ### Load time
  82. ```
  83. chalk :: 14.543ms
  84. kleur :: 0.474ms
  85. ansi-colors :: 1.923ms
  86. ```
  87. ### Performance
  88. ```
  89. # All Colors
  90. ansi-colors x 199,381 ops/sec ±1.04% (96 runs sampled)
  91. chalk x 12,107 ops/sec ±2.07% (87 runs sampled)
  92. kleur x 715,334 ops/sec ±0.30% (93 runs sampled)
  93. # Stacked colors
  94. ansi-colors x 24,494 ops/sec ±1.03% (93 runs sampled)
  95. chalk x 2,650 ops/sec ±2.06% (85 runs sampled)
  96. kleur x 75,798 ops/sec ±0.19% (97 runs sampled)
  97. # Nested colors
  98. ansi-colors x 77,766 ops/sec ±0.32% (94 runs sampled)
  99. chalk x 5,596 ops/sec ±1.85% (86 runs sampled)
  100. kleur x 137,660 ops/sec ±0.31% (93 runs sampled)
  101. ```
  102. ## Credits
  103. This project originally forked [Brian Woodward](https://github.com/doowb)'s awesome [`ansi-colors`](https://github.com/doowb/ansi-colors) library.
  104. Beginning with `kleur@3.0`, the Chalk-style syntax (magical getter) has been replaced with function calls per key:
  105. ```js
  106. // Old:
  107. c.red.bold.underline('old');
  108. // New:
  109. c.red().bold().underline('new');
  110. ```
  111. > <sup><em>As I work more with Rust, the newer syntax feels so much better & more natural!</em></sup>
  112. If you prefer the old syntax, you may migrate to `ansi-colors`. Versions below `kleur@3.0` have been deprecated.
  113. ## License
  114. MIT © [Luke Edwards](https://lukeed.com)