Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Description and SaucerHead features #15

Merged
merged 1 commit into from
Jun 9, 2018

Conversation

CrushedPixel
Copy link
Contributor

This commit adds the OptionSetDescription function, which specifies a string to render in front of the progress bar.
It also adds the SaucerHead field to the Theme struct, which allows for the rightmost part of the saucer to be a different character than the others.
This is useful for arrow-like progress bars, as I use them in one of my projects:
Preview
Both of these changes are 100% backwards-compatible, so the behaviour of existing projects does not change - if the SaucerHead field is empty, the value of Saucer is used for the saucer head.

@schollz schollz merged commit 7b9a21f into schollz:master Jun 9, 2018
@schollz
Copy link
Owner

schollz commented Jun 9, 2018

Thanks @CrushedPixel. This is great!
By the way, how did you get the colors?

@CrushedPixel
Copy link
Contributor Author

I got the colors using mitchellh/colorstring in combination with k0kubun/go-ansi for Windows support.
I set the theme to:

Saucer:        colorstring.Color("[green]="),
SaucerHead:    colorstring.Color("[green]>"),

and render the progress bar into a bytes.Buffer which I later print using ansi.Print, which makes the color codes windows-compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants