From a0277bccdcd9ac9433acf10f7010846b6ccf4d97 Mon Sep 17 00:00:00 2001 From: Shri Date: Wed, 18 Feb 2026 11:58:43 -0800 Subject: [PATCH] Fix theme cycling wiping all CSS action_toggle_theme called stylesheet.source.clear() which removed the app's structural layout CSS (#main-content, #right-panel sizing). Only the theme file was re-added, so the UI collapsed to a single colored screen. - Remove hardcoded Screen colors from TAMEApp.CSS so themes control it - Re-add app's structural CSS after clearing before adding theme CSS --- tame/app.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tame/app.py b/tame/app.py index 9ddbe31..87aa5cb 100644 --- a/tame/app.py +++ b/tame/app.py @@ -101,11 +101,6 @@ class TAMEApp(App): CSS = """ - Screen { - background: #1e1e1e; - color: #d4d4d4; - } - #main-content { height: 1fr; width: 1fr; @@ -621,6 +616,9 @@ def action_toggle_theme(self) -> None: css_path = self._theme_manager.get_css_path() if css_path: self.stylesheet.source.clear() + # Re-add the app's structural layout CSS first + self.stylesheet.add_source(self.CSS, read_from=("TAMEApp", "")) + # Then add the new theme CSS (Screen colors, widget colors) self.stylesheet.add_source( css_path.read_text(), read_from=(str(css_path), "") )