From 78a9c939327ee3422482a43b959f0794e73ea66a Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Sun, 29 Nov 2020 18:34:17 -0700 Subject: [PATCH] remove restart from color method and update readme Signed-off-by: Brian Downs --- README.md | 94 +++++++++++++++++++++++++++--------------------------- spinner.go | 4 +-- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 516b0f3..ddae178 100644 --- a/README.md +++ b/README.md @@ -17,52 +17,52 @@ go get github.com/briandowns/spinner ## Available Character Sets (Numbered by their slice index) -index | character set | sample gif -------|---------------|--------------- -0 | ```←↖↑↗→↘↓↙``` | ![Sample Gif](gifs/0.gif) -1 | ```▁▃▄▅▆▇█▇▆▅▄▃▁``` | ![Sample Gif](gifs/1.gif) -2 | ```▖▘▝▗``` | ![Sample Gif](gifs/2.gif) -3 | ```┤┘┴└├┌┬┐``` | ![Sample Gif](gifs/3.gif) -4 | ```◢◣◤◥``` | ![Sample Gif](gifs/4.gif) -5 | ```◰◳◲◱``` | ![Sample Gif](gifs/5.gif) -6 | ```◴◷◶◵``` | ![Sample Gif](gifs/6.gif) -7 | ```◐◓◑◒``` | ![Sample Gif](gifs/7.gif) -8 | ```.oO@*``` | ![Sample Gif](gifs/8.gif) -9 | ```\|/-\``` | ![Sample Gif](gifs/9.gif) -10 | ```◡◡⊙⊙◠◠``` | ![Sample Gif](gifs/10.gif) -11 | ```⣾⣽⣻⢿⡿⣟⣯⣷``` | ![Sample Gif](gifs/11.gif) -12 | ```>))'> >))'> >))'> >))'> >))'> <'((< <'((< <'((<``` | ![Sample Gif](gifs/12.gif) -13 | ```⠁⠂⠄⡀⢀⠠⠐⠈``` | ![Sample Gif](gifs/13.gif) -14 | ```⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏``` | ![Sample Gif](gifs/14.gif) -15 | ```abcdefghijklmnopqrstuvwxyz``` | ![Sample Gif](gifs/15.gif) -16 | ```▉▊▋▌▍▎▏▎▍▌▋▊▉``` | ![Sample Gif](gifs/16.gif) -17 | ```■□▪▫``` | ![Sample Gif](gifs/17.gif) -18 | ```←↑→↓``` | ![Sample Gif](gifs/18.gif) -19 | ```╫╪``` | ![Sample Gif](gifs/19.gif) -20 | ```⇐⇖⇑⇗⇒⇘⇓⇙``` | ![Sample Gif](gifs/20.gif) -21 | ```⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈``` | ![Sample Gif](gifs/21.gif) -22 | ```⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈``` | ![Sample Gif](gifs/22.gif) -23 | ```⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁``` | ![Sample Gif](gifs/23.gif) -24 | ```⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓⠋``` | ![Sample Gif](gifs/24.gif) -25 | ```ヲァィゥェォャュョッアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン``` | ![Sample Gif](gifs/25.gif) -26 | ```. .. ...``` | ![Sample Gif](gifs/26.gif) -27 | ```▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▏▎▍▌▋▊▉█▇▆▅▄▃▂▁``` | ![Sample Gif](gifs/27.gif) -28 | ```.oO°Oo.``` | ![Sample Gif](gifs/28.gif) -29 | ```+x``` | ![Sample Gif](gifs/29.gif) -30 | ```v<^>``` | ![Sample Gif](gifs/30.gif) -31 | ```>>---> >>---> >>---> >>---> >>---> <---<< <---<< <---<< <---<< <---<<``` | ![Sample Gif](gifs/31.gif) -32 | ```\| \|\| \|\|\| \|\|\|\| \|\|\|\|\| \|\|\|\|\|\| \|\|\|\|\| \|\|\|\| \|\|\| \|\| \|``` | ![Sample Gif](gifs/32.gif) -33 | ```[] [=] [==] [===] [====] [=====] [======] [=======] [========] [=========] [==========]``` | ![Sample Gif](gifs/33.gif) -34 | ```(*---------) (-*--------) (--*-------) (---*------) (----*-----) (-----*----) (------*---) (-------*--) (--------*-) (---------*)``` | ![Sample Gif](gifs/34.gif) -35 | ```█▒▒▒▒▒▒▒▒▒ ███▒▒▒▒▒▒▒ █████▒▒▒▒▒ ███████▒▒▒ ██████████``` | ![Sample Gif](gifs/35.gif) -36 | ```[ ] [=> ] [===> ] [=====> ] [======> ] [========> ] [==========> ] [============> ] [==============> ] [================> ] [==================> ] [===================>]``` | ![Sample Gif](gifs/36.gif) -37 | ```🕐 🕑 🕒 🕓 🕔 🕕 🕖 🕗 🕘 🕙 🕚 🕛``` | ![Sample Gif](gifs/37.gif) -38 | ```🕐 🕜 🕑 🕝 🕒 🕞 🕓 🕟 🕔 🕠 🕕 🕡 🕖 🕢 🕗 🕣 🕘 🕤 🕙 🕥 🕚 🕦 🕛 🕧``` | ![Sample Gif](gifs/38.gif) -39 | ```🌍 🌎 🌏``` | ![Sample Gif](gifs/39.gif) -40 | ```◜ ◝ ◞ ◟``` | ![Sample Gif](gifs/40.gif) -41 | ```⬒ ⬔ ⬓ ⬕``` | ![Sample Gif](gifs/41.gif) -42 | ```⬖ ⬘ ⬗ ⬙``` | ![Sample Gif](gifs/42.gif) -43 | ```[>>> >] []>>>> [] [] >>>> [] [] >>>> [] [] >>>> [] [] >>>>[] [>> >>]``` | ![Sample Gif](gifs/43.gif) +| index | character set | sample gif | +| ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- | +| 0 | ```←↖↑↗→↘↓↙``` | ![Sample Gif](gifs/0.gif) | +| 1 | ```▁▃▄▅▆▇█▇▆▅▄▃▁``` | ![Sample Gif](gifs/1.gif) | +| 2 | ```▖▘▝▗``` | ![Sample Gif](gifs/2.gif) | +| 3 | ```┤┘┴└├┌┬┐``` | ![Sample Gif](gifs/3.gif) | +| 4 | ```◢◣◤◥``` | ![Sample Gif](gifs/4.gif) | +| 5 | ```◰◳◲◱``` | ![Sample Gif](gifs/5.gif) | +| 6 | ```◴◷◶◵``` | ![Sample Gif](gifs/6.gif) | +| 7 | ```◐◓◑◒``` | ![Sample Gif](gifs/7.gif) | +| 8 | ```.oO@*``` | ![Sample Gif](gifs/8.gif) | +| 9 | ```\|/-\``` | ![Sample Gif](gifs/9.gif) | +| 10 | ```◡◡⊙⊙◠◠``` | ![Sample Gif](gifs/10.gif) | +| 11 | ```⣾⣽⣻⢿⡿⣟⣯⣷``` | ![Sample Gif](gifs/11.gif) | +| 12 | ```>))'> >))'> >))'> >))'> >))'> <'((< <'((< <'((<``` | ![Sample Gif](gifs/12.gif) | +| 13 | ```⠁⠂⠄⡀⢀⠠⠐⠈``` | ![Sample Gif](gifs/13.gif) | +| 14 | ```⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏``` | ![Sample Gif](gifs/14.gif) | +| 15 | ```abcdefghijklmnopqrstuvwxyz``` | ![Sample Gif](gifs/15.gif) | +| 16 | ```▉▊▋▌▍▎▏▎▍▌▋▊▉``` | ![Sample Gif](gifs/16.gif) | +| 17 | ```■□▪▫``` | ![Sample Gif](gifs/17.gif) | +| 18 | ```←↑→↓``` | ![Sample Gif](gifs/18.gif) | +| 19 | ```╫╪``` | ![Sample Gif](gifs/19.gif) | +| 20 | ```⇐⇖⇑⇗⇒⇘⇓⇙``` | ![Sample Gif](gifs/20.gif) | +| 21 | ```⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈``` | ![Sample Gif](gifs/21.gif) | +| 22 | ```⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈``` | ![Sample Gif](gifs/22.gif) | +| 23 | ```⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁``` | ![Sample Gif](gifs/23.gif) | +| 24 | ```⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓⠋``` | ![Sample Gif](gifs/24.gif) | +| 25 | ```ヲァィゥェォャュョッアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン``` | ![Sample Gif](gifs/25.gif) | +| 26 | ```. .. ...``` | ![Sample Gif](gifs/26.gif) | +| 27 | ```▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▏▎▍▌▋▊▉█▇▆▅▄▃▂▁``` | ![Sample Gif](gifs/27.gif) | +| 28 | ```.oO°Oo.``` | ![Sample Gif](gifs/28.gif) | +| 29 | ```+x``` | ![Sample Gif](gifs/29.gif) | +| 30 | ```v<^>``` | ![Sample Gif](gifs/30.gif) | +| 31 | ```>>---> >>---> >>---> >>---> >>---> <---<< <---<< <---<< <---<< <---<<``` | ![Sample Gif](gifs/31.gif) | +| 32 | ```\| \|\| \|\|\| \|\|\|\| \|\|\|\|\| \|\|\|\|\|\| \|\|\|\|\| \|\|\|\| \|\|\| \|\| \|``` | ![Sample Gif](gifs/32.gif) | +| 33 | ```[] [=] [==] [===] [====] [=====] [======] [=======] [========] [=========] [==========]``` | ![Sample Gif](gifs/33.gif) | +| 34 | ```(*---------) (-*--------) (--*-------) (---*------) (----*-----) (-----*----) (------*---) (-------*--) (--------*-) (---------*)``` | ![Sample Gif](gifs/34.gif) | +| 35 | ```█▒▒▒▒▒▒▒▒▒ ███▒▒▒▒▒▒▒ █████▒▒▒▒▒ ███████▒▒▒ ██████████``` | ![Sample Gif](gifs/35.gif) | +| 36 | ```[ ] [=> ] [===> ] [=====> ] [======> ] [========> ] [==========> ] [============> ] [==============> ] [================> ] [==================> ] [===================>]``` | ![Sample Gif](gifs/36.gif) | +| 37 | ```🕐 🕑 🕒 🕓 🕔 🕕 🕖 🕗 🕘 🕙 🕚 🕛``` | ![Sample Gif](gifs/37.gif) | +| 38 | ```🕐 🕜 🕑 🕝 🕒 🕞 🕓 🕟 🕔 🕠 🕕 🕡 🕖 🕢 🕗 🕣 🕘 🕤 🕙 🕥 🕚 🕦 🕛 🕧``` | ![Sample Gif](gifs/38.gif) | +| 39 | ```🌍 🌎 🌏``` | ![Sample Gif](gifs/39.gif) | +| 40 | ```◜ ◝ ◞ ◟``` | ![Sample Gif](gifs/40.gif) | +| 41 | ```⬒ ⬔ ⬓ ⬕``` | ![Sample Gif](gifs/41.gif) | +| 42 | ```⬖ ⬘ ⬗ ⬙``` | ![Sample Gif](gifs/42.gif) | +| 43 | ```[>>> >] []>>>> [] [] >>>> [] [] >>>> [] [] >>>> [] [] >>>>[] [>> >>]``` | ![Sample Gif](gifs/43.gif) | ## Features @@ -139,7 +139,7 @@ s.Prefix = "prefixed text: " // Prefix text before the spinner s.Suffix = " :appended text" // Append text after the spinner ``` -## Set or change the color of the spinner. Default color is white. This will restart the spinner with the new color. +## Set or change the color of the spinner. Default color is white. The spinner will need to be restarted to pick up the change. ```Go s.Color("red") // Set the spinner color to red diff --git a/spinner.go b/spinner.go index 07ebf18..5ce6870 100644 --- a/spinner.go +++ b/spinner.go @@ -356,7 +356,8 @@ func (s *Spinner) Reverse() { } } -// Color will set the struct field for the given color to be used. +// Color will set the struct field for the given color to be used. The spinner +// will need to be explicitly restarted. func (s *Spinner) Color(colors ...string) error { colorAttributes := make([]color.Attribute, len(colors)) @@ -371,7 +372,6 @@ func (s *Spinner) Color(colors ...string) error { s.mu.Lock() s.color = color.New(colorAttributes...).SprintFunc() s.mu.Unlock() - s.Restart() return nil }