Skip to content

Commit

Permalink
Print theme code to user in theming example (nerfstudio-project#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
tancik authored Sep 14, 2023
1 parent 255eb11 commit 74eb5e1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/13_theming.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@
brand_color = server.add_gui_rgb("Brand color", (230, 180, 30))
synchronize = server.add_gui_button("Apply theme", icon=viser.Icon.CHECK)

gui_theme_code = server.add_gui_markdown("no theme applied yet")


def synchronize_theme() -> None:
global gui_theme_code
server.configure_theme(
dark_mode=dark_mode.value,
titlebar_content=titlebar_theme if titlebar.value else None,
Expand All @@ -61,6 +64,21 @@ def synchronize_theme() -> None:
)
server.world_axes.visible = True

gui_theme_code.remove()
gui_theme_code = server.add_gui_markdown(
f"""
### Current applied theme
```
server.configure_theme(
dark_mode={dark_mode.value},
titlebar_content={"titlebar_content" if titlebar.value else None},
control_layout="{control_layout.value}",
brand_color={brand_color.value},
)
```
"""
)


synchronize.on_click(lambda _: synchronize_theme())
synchronize_theme()
Expand Down

0 comments on commit 74eb5e1

Please sign in to comment.