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

[REQUEST] Rich progress bar changes color based on the number steps/files elapsed. #3379

Closed
ketan96-m opened this issue Jun 11, 2024 · 3 comments

Comments

@ketan96-m
Copy link

Consider posting in https://github.com/textualize/rich/discussions for feedback before raising a feature request.

Have you checked the issues for a similar suggestions?
Yes

How would you improve Rich?

My application submits a bunch of transformation to a server and the rich bar gives the status of the transformation and eventual downloads. However, these transformation are prone to failures and I would like to change the color of my progress bar to indicate that some failure has occurred while other transformations continue.

image
I would like to change the bar color to red because it stopped just before finishing.

The update function does provide ways to make changes but I couldn't find a way to change the color of the bar using BarColumn() when passed as a keyword argument to the update method.
e.g

progress.update(
                    progress_task,
                    progress_bar_title,
                    completed=self.current_status.files_completed,
                    bar = BarColumn(complete_style="rgb(0,0,255)",
                                             style="rgb(255,0,0)")
                )

What problem does it solve for you?

This will add more style to the progress bar when there are failures or if we can't reach 100%.

Copy link

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

@willmcgugan
Copy link
Collaborator

You can override Progress.get_renderables() to display the progress however you like.

Copy link

I hope we solved your problem.

If you like using Rich, you might also enjoy Textual

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

No branches or pull requests

2 participants