Skip to content

favware/colorette-spinner

Repository files navigation

colorette-spinner

A super tiny and efficient terminal spinner based on nanospinner

GitHub npm

Support Server

Description

This is an extremely tiny and simple terminal spinner based on nanospinner while using [colorette] instead of picocolors

Installation

You can use the following command to install this package, or replace npm install -D with your package manager of choice.

npm install -D @favware/colorette-spinner

Usage

.spin()

Looping over spin method will animate a given spinner.

setInterval(() => {
  spinner.spin();
}, 25);
.start(options?)

In order to start the spinner call start. This will perform drawing the spinning animation

spinner.start();
spinner.start({ text: 'Start', color: 'yellow' });
.stop(options?)

In order to stop the spinner call stop. This will finish drawing the spinning animation and return to new line.

spinner.stop();
spinner.stop({ text: 'Done!', mark: ':O', color: 'magenta' });
.success(options?)

Use success call to stop the spinning animation and replace the spinning symbol with check mark character to indicate successful completion.

spinner.success();
spinner.success({ text: 'Successful!', mark: ':)' });
.warn(options?)

Use warn call to stop the spinning animation and replace the spinning symbol with warn mark character to indicate warning completion.

spinner.warn();
spinner.warn({ text: 'Warning!', mark: ':|' });
.error(options?)

Use error call to stop the spinning animation and replace the spinning symbol with cross character to indicate error completion.

spinner.error();
spinner.error({ text: 'Error!', mark: ':(' });
.update(options?)

Use update call to dynamically change

spinner.update({
  text: 'Run test',
  color: 'white',
  stream: process.stdout,
  frames: ['.', 'o', '0', '@', '*'],
  interval: 100
});
.clear()

Clears the spinner`s output

spinner.clear();
.reset()

In order to reset the spinner to its initial frame do:

spinner.reset();

Buy us some doughnuts

Favware projects are and always will be open source, even if we don't get donations. That being said, we know there are amazing people who may still want to donate just to show their appreciation. Thank you very much in advance!

We accept donations through Ko-fi, Paypal, Patreon, GitHub Sponsorships, and various cryptocurrencies. You can use the buttons below to donate through your method of choice.

Donate With Address
Ko-fi Click Here
Patreon Click Here
PayPal Click Here
GitHub Sponsors Click Here
Bitcoin 1E643TNif2MTh75rugepmXuq35Tck4TnE5
Ethereum 0xF653F666903cd8739030D2721bF01095896F5D6E
LiteCoin LZHvBkaJqKJRa8N7Dyu41Jd1PDBAofCik6

Contributors

Please make sure to read the Contributing Guide before making a pull request.

Thank you to all the people who already contributed to Sapphire!