-
Notifications
You must be signed in to change notification settings - Fork 25
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Dynamically change color of status bar #56
Comments
It's not documented specifically, but you can change the color attribute for the counter. It does the same validation for the color that's done when you originally set it. Will you change the color once or twice or many times during the program's runtime? import time
import enlighten
counter = enlighten.Counter(total=100, desc='Example', unit='ticks', color='red')
for num in range(100):
time.sleep(0.05) # Simulate work
if num == 50:
counter.color = 'blue'
counter.update() |
Oh sweet! Thanks for the quick reply. I do plan on changing the color many times during the runtime. Do you think that could constitute an issue? |
There's a small overhead in validating the color. I don't think you'll notice it, but I could probably move it to it's own method and make it caching so it can be skipped, but I wouldn't worry about it for now. |
Hm ye that might be a problem. I'd be changing color quite a bit. I'll run some tests and then decide, thanks! |
Color resolution caching added in 1.12.0 |
Is your feature request related to a problem? Please describe.
Would be nice to have a color input in the update function of the status bar to change the color dynamically.
Describe alternatives you've considered
Recreating the color bar instead of updating it does the trick, yet it seems impractical.
Additional context
I am not sure if this is already possible or if there's a workaround. I also have not seen it anywhere in the documentation. Sorry if I missed it.
The text was updated successfully, but these errors were encountered: