diff --git a/examples/13_theming.py b/examples/13_theming.py index 2eaa93b3b..1600c304e 100644 --- a/examples/13_theming.py +++ b/examples/13_theming.py @@ -31,8 +31,8 @@ ), ) image = TitlebarImage( - image_url_light="https://docs.nerf.studio/en/latest/_static/imgs/logo.png", - image_url_dark="https://docs.nerf.studio/en/latest/_static/imgs/logo-dark.png", + image_url_light="https://docs.nerf.studio/_static/imgs/logo.png", + image_url_dark="https://docs.nerf.studio/_static/imgs/logo-dark.png", image_alt="NerfStudio Logo", href="https://docs.nerf.studio/", ) @@ -48,6 +48,7 @@ ) titlebar = server.add_gui_checkbox("Titlebar", initial_value=True) dark_mode = server.add_gui_checkbox("Dark mode", initial_value=True) +show_logo = server.add_gui_checkbox("Show logo", initial_value=True) brand_color = server.add_gui_rgb("Brand color", (230, 180, 30)) synchronize = server.add_gui_button("Apply theme", icon=viser.Icon.CHECK) @@ -57,9 +58,10 @@ 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, control_layout=control_layout.value, + dark_mode=dark_mode.value, + show_logo=show_logo.value, brand_color=brand_color.value, ) server.world_axes.visible = True @@ -70,9 +72,10 @@ def synchronize_theme() -> None: ### 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}", + dark_mode={dark_mode.value}, + show_logo={show_logo.value}, brand_color={brand_color.value}, ) ``` diff --git a/src/viser/_message_api.py b/src/viser/_message_api.py index 1c884c916..148808e6f 100644 --- a/src/viser/_message_api.py +++ b/src/viser/_message_api.py @@ -177,6 +177,7 @@ def configure_theme( titlebar_content: Optional[theme.TitlebarConfig] = None, control_layout: Literal["floating", "collapsible", "fixed"] = "floating", dark_mode: bool = False, + show_logo: bool = True, brand_color: Optional[Tuple[int, int, int]] = None, ) -> None: """Configure the viser front-end's visual appearance.""" @@ -223,6 +224,7 @@ def configure_theme( titlebar_content=titlebar_content, control_layout=control_layout, dark_mode=dark_mode, + show_logo=show_logo, colors=colors_cast, ), ) diff --git a/src/viser/_messages.py b/src/viser/_messages.py index c827b4e18..7971fb542 100644 --- a/src/viser/_messages.py +++ b/src/viser/_messages.py @@ -521,8 +521,9 @@ class ThemeConfigurationMessage(Message): titlebar_content: Optional[theme.TitlebarConfig] control_layout: Literal["floating", "collapsible", "fixed"] - colors: Optional[Tuple[str, str, str, str, str, str, str, str, str, str]] + show_logo: bool dark_mode: bool + colors: Optional[Tuple[str, str, str, str, str, str, str, str, str, str]] @dataclasses.dataclass diff --git a/src/viser/client/index.html b/src/viser/client/index.html index 218df4beb..eb4152721 100644 --- a/src/viser/client/index.html +++ b/src/viser/client/index.html @@ -2,11 +2,10 @@
- + -