Textualize / rich

Rich is a Python library for rich text and beautiful formatting in the terminal.
https://rich.readthedocs.io/en/latest/
MIT License
48.1k stars 1.69k forks source link

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

Closed ketan96-m closed 3 weeks ago

ketan96-m commented 3 weeks ago

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%.

github-actions[bot] commented 3 weeks ago

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 commented 3 weeks ago

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

github-actions[bot] commented 3 weeks ago

I hope we solved your problem.

If you like using Rich, you might also enjoy Textual