Skip to content

Commit

Permalink
feat: added arrows mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Alcadramin committed Oct 2, 2024
1 parent fb81563 commit 80e1284
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions zolt.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@ class Zolt {
#spinnerFrames = {
dots: {
frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],
speed: 100,
speed: 100
},
bars: {
frames: ['|', '/', '-', '\\'],
speed: 150,
speed: 150
},
arrows: {
frames: ['↑', '↗', '→', '↘', '↓', '↙', '←', '↖'],
speed: 150
}
};
#interval;
#currentFrame = 0;

/**
* Start the spinner.
* @param {('dots'|'bars')} [mode='dots'] - Spinner mode: 'dots' or 'bars'.
* @param {('black'|'red'|'green'|'yellow'|'blue'|'magenta'|'cyan'|'white'|'brightBlack'|'brightRed'|'brightGreen'|'brightYellow'|'brightBlue'|'brightMagenta'|'brightCyan'|'brightWhite'|'reset')} [color='reset'] - Color of the spinner (supports predefined 32 color codes). * @param {string} [text=''] - Text to display next to the spinner.
* @param {('black'|'red'|'green'|'yellow'|'blue'|'magenta'|'cyan'|'white'|'brightBlack'|'brightRed'|'brightGreen'|'brightYellow'|'brightBlue'|'brightMagenta'|'brightCyan'|'brightWhite'|'reset')} [color='reset'] - Color of the spinner (supports predefined 32 color codes).
* @param {string} [text=''] - Text to display next to the spinner.
*/
static start(mode = 'dots', color = 'reset', text = '') {
const spinner = new Zolt(); // Use an instance to keep track of frames.
Expand Down Expand Up @@ -74,7 +79,7 @@ class Zolt {
brightBlue: '\x1b[94m',
brightMagenta: '\x1b[95m',
brightCyan: '\x1b[96m',
brightWhite: '\x1b[97m',
brightWhite: '\x1b[97m'
};

return colors[color] || colors.reset;
Expand Down

0 comments on commit 80e1284

Please sign in to comment.