libspinner
libspinner copied to clipboard
A pure C single-header library with 90 configurable terminal spinner/progress indicators.
trafficstars
libspinner
libspinner is a C single-headerlibrary that provides terminal spinners and progress indicators to display in the terminal. This is a port of the Go library here.
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
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.









































