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

[Feature request] Allow multicolor progress bars #53

Closed
ehmicky opened this issue Nov 2, 2019 · 8 comments
Closed

[Feature request] Allow multicolor progress bars #53

ehmicky opened this issue Nov 2, 2019 · 8 comments
Labels

Comments

@ehmicky
Copy link
Contributor

ehmicky commented Nov 2, 2019

This would be great if the "complete" part of the progress bar could be of a different color than the "incomplete" part of it.

Using ANSI color escapes in the barCompleteChar or barIncompleteChar options does not currently work because the values for those options must currently be 1 character long. Using colors in those options make the progress bar shorter and jump left and right.

(Note that it is possible though to give a color to the whole bar as the shades_grey preset shows.)

@AndiDittrich
Copy link
Member

use a custom formatter

@ehmicky
Copy link
Contributor Author

ehmicky commented Nov 2, 2019

@AndiDittrich What about improving the default formatter instead?

I believe all that is needed is to replace string.substr() by slice-ansi() in the following three lines: https://github.com/AndiDittrich/Node.CLI-Progress/blob/master/lib/formatter.js#L30-L34.

I can submit a PR if you want.

@AndiDittrich
Copy link
Member

generally the dependencies should be reduced to zero in the near future - it's a big problem to audit each dependency...therefore i won't add any new libraries (it is not neccessary to achive your goal).

@ehmicky
Copy link
Contributor Author

ehmicky commented Nov 2, 2019

Alright, no worries!

@ehmicky ehmicky closed this as completed Nov 2, 2019
@AndiDittrich
Copy link
Member

whats about an option like "barGlue" ? that's the easiest way to add custom colors for each sub-bar

@AndiDittrich AndiDittrich reopened this Nov 2, 2019
@ehmicky
Copy link
Contributor Author

ehmicky commented Nov 2, 2019

Sure that works. However I would not go for a PR for this anymore. Thanks for the help though!

@AndiDittrich
Copy link
Member

the barGlue option has been added to the master branch (upcoming v3.6)

@ehmicky
Copy link
Contributor Author

ehmicky commented Jan 23, 2020

Thanks!

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

No branches or pull requests

2 participants