Skip to content

Fix theme switching for the plot widget #198

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

Merged
merged 2 commits into from
Jul 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/uproot_browser/tui/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def action_toggle_theme(self) -> None:
theme = "textual-light" if dark else "textual-dark"

if self.plot_widget.item:
self.plot_widget.item.theme = "dark" if dark else "default"
self.plot_widget.item.theme = "default" if dark else "dark"
self.theme = theme

def on_uproot_selected(self, message: UprootSelected) -> None:
Expand Down
14 changes: 14 additions & 0 deletions tests/test_tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ async def test_browse_plot() -> None:
assert pilot.app.query_one("#main-view").current == "plot"


async def test_theme_switch() -> None:
async with Browser(
skhep_testdata.data_path("uproot-Event.root")
).run_test() as pilot:
await pilot.press("down", "down", "down", "enter")
browser_theme = pilot.app.theme
plot_theme = pilot.app.theme
await pilot.press("t")
new_browser_theme = pilot.app.theme
new_plot_theme = pilot.app.theme
assert browser_theme != new_browser_theme
assert plot_theme != new_plot_theme


async def test_browse_empty() -> None:
async with Browser(
skhep_testdata.data_path("uproot-empty.root")
Expand Down
Loading