Circular Progress: Changing the colour after it is created #5029
-
First Check
Example Codefrom nicegui import ui
progress = ui.circular_progress(value=0.25, color="pink-7")
def change_color(element, color):
element.classes(f"{color}")
ui.button("Change Color", on_click=lambda: change_color(progress, "green-13"))
ui.run() DescriptionHi, thanks for this magnificent project. I'm sure the answer maybe obvious, but I can't find an easy way to change the color of the circular_progress element after it was created. I've resorted to doing something like the below: from nicegui import html, ui
progress = html.div()
def change_color(element, color):
element.clear()
with element:
ui.circular_progress(value=0.25, color=color)
change_color(progress, "pink-7")
ui.button("Change Color", on_click=lambda: change_color(progress, "green-13"))
ui.run() A little guidance would be appreciated, thanks. NiceGUI Version2.21.0 Python Version3.12.3 BrowserOther Operating SystemWindows Additional ContextI'm using WSL, and the browser is Brave |
Beta Was this translation helpful? Give feedback.
Answered by
falkoschindler
Aug 12, 2025
Replies: 1 comment 1 reply
-
Hi @dev-artisan, In this case the color is set as a prop: element.props(f'color={color}') ![]() |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dev-artisan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @dev-artisan,
In this case the color is set as a prop: