https://github.com/briandowns/libspinner
C library with 90 configurable terminal spinner/progress indicators.
https://github.com/briandowns/libspinner
c c-language indicator progress progress-bar shell spinner terminal
Last synced: about 1 year ago
JSON representation
C library with 90 configurable terminal spinner/progress indicators.
- Host: GitHub
- URL: https://github.com/briandowns/libspinner
- Owner: briandowns
- License: bsd-2-clause
- Created: 2019-02-16T15:46:20.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-03-14T04:41:36.000Z (over 1 year ago)
- Last Synced: 2025-03-24T03:12:02.301Z (over 1 year ago)
- Topics: c, c-language, indicator, progress, progress-bar, shell, spinner, terminal
- Language: C
- Homepage:
- Size: 316 KB
- Stars: 31
- Watchers: 4
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# libspinner
[](https://travis-ci.org/briandowns/libspinner)
libspinner is a C single-header library that provides terminal spinners and progress indicators. This is a port of the Go library [here](https://github.com/briandowns/spinner).
*NOTE*: Be sure to call `spinner_stop(s)` in any signal handlers or clean up routines so the underlying pthread doesn't leak.
An example can be found in the `examples` directory.
## Test
```sh
make test
```
## Features
* Start
* Stop
* Restart
* Reverse direction [in progress]
* Update the spinner character set
* Update the spinner speed
* Prefix or append text
* Change spinner color, background, and text attributes such as bold / italics [in progress]
* Chain, pipe, redirect output
* Output final string on spinner/indicator completion
## 90 Character Sets. Some examples below:
(cursor not visible in normal operation)
| index | character set | sample gif |
| ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| 0 | ```←↖↑↗→↘↓↙``` |  |
| 1 | ```▁▃▄▅▆▇█▇▆▅▄▃▁``` |  |
| 2 | ```▖▘▝▗``` |  |
| 3 | ```┤┘┴└├┌┬┐``` |  |
| 4 | ```◢◣◤◥``` |  |
| 5 | ```◰◳◲◱``` |  |
| 6 | ```◴◷◶◵``` |  |
| 7 | ```◐◓◑◒``` |  |
| 8 | ```.oO@*``` |  |
| 9 | ```\|/-\``` |  |
| 10 | ```◡◡⊙⊙◠◠``` |  |
| 11 | ```⣾⣽⣻⢿⡿⣟⣯⣷``` |  |
| 12 | ```>))'> >))'> >))'> >))'> >))'> <'((< <'((< <'((<``` |  |
| 13 | ```⠁⠂⠄⡀⢀⠠⠐⠈``` |  |
| 14 | ```⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏``` |  |
| 15 | ```abcdefghijklmnopqrstuvwxyz``` |  |
| 16 | ```▉▊▋▌▍▎▏▎▍▌▋▊▉``` |  |
| 17 | ```■□▪▫``` |  |
| 18 | ```←↑→↓``` |  |
| 19 | ```╫╪``` |  |
| 20 | ```⇐⇖⇑⇗⇒⇘⇓⇙``` |  |
| 21 | ```⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈``` |  |
| 22 | ```⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈``` |  |
| 23 | ```⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁``` |  |
| 24 | ```⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓⠋``` |  |
| 25 | ```ヲァィゥェォャュョッアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン``` |  |
| 26 | ```. .. ...``` |  |
| 27 | ```▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▏▎▍▌▋▊▉█▇▆▅▄▃▂▁``` |  |
| 28 | ```.oO°Oo.``` |  |
| 29 | ```+x``` |  |
| 30 | ```v<^>``` |  |
| 31 | ```>>---> >>---> >>---> >>---> >>---> <---<< <---<< <---<< <---<< <---<<``` |  |
| 32 | ```\| \|\| \|\|\| \|\|\|\| \|\|\|\|\| \|\|\|\|\|\| \|\|\|\|\| \|\|\|\| \|\|\| \|\| \|``` |  |
| 33 | ```[] [=] [==] [===] [====] [=====] [======] [=======] [========] [=========] [==========]``` |  |
| 34 | ```(*---------) (-*--------) (--*-------) (---*------) (----*-----) (-----*----) (------*---) (-------*--) (--------*-) (---------*)``` |  |
| 35 | ```█▒▒▒▒▒▒▒▒▒ ███▒▒▒▒▒▒▒ █████▒▒▒▒▒ ███████▒▒▒ ██████████``` |  |
| 36 | ```[ ] [=> ] [===> ] [=====> ] [======> ] [========> ] [==========> ] [============> ] [==============> ] [================> ] [==================> ] [===================>]``` |  |
| 37 | ```🌍 🌎 🌏``` |  |
| 38 | ```◜ ◝ ◞ ◟``` |  |
| 39 | ```⬒ ⬔ ⬓ ⬕``` |  |
| 40 | ```⬖ ⬘ ⬗ ⬙``` |  |
| 41 | ```[>>> >] []>>>> [] [] >>>> [] [] >>>> [] [] >>>> [] [] >>>>[] [>> >>]``` |  |
## Contributing
Please feel free to open a PR!
## License
libspinner source code is available under the BSD 2 clause [License](/LICENSE).
## Contact
[@bdowns328](http://twitter.com/bdowns328)