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.

style.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. 'use strict';
  2. const c = require('kleur');
  3. const figures = require('./figures'); // rendering user input.
  4. const styles = Object.freeze({
  5. password: {
  6. scale: 1,
  7. render: input => '*'.repeat(input.length)
  8. },
  9. emoji: {
  10. scale: 2,
  11. render: input => '😃'.repeat(input.length)
  12. },
  13. invisible: {
  14. scale: 0,
  15. render: input => ''
  16. },
  17. default: {
  18. scale: 1,
  19. render: input => `${input}`
  20. }
  21. });
  22. const render = type => styles[type] || styles.default; // icon to signalize a prompt.
  23. const symbols = Object.freeze({
  24. aborted: c.red(figures.cross),
  25. done: c.green(figures.tick),
  26. exited: c.yellow(figures.cross),
  27. default: c.cyan('?')
  28. });
  29. const symbol = (done, aborted, exited) => aborted ? symbols.aborted : exited ? symbols.exited : done ? symbols.done : symbols.default; // between the question and the user's input.
  30. const delimiter = completing => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
  31. const item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : '+' : figures.line);
  32. module.exports = {
  33. styles,
  34. render,
  35. symbols,
  36. symbol,
  37. delimiter,
  38. item
  39. };