source: frontend/node_modules/prompts/lib/util/style.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

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