From 1c909aaa93258753975d401afea76b80a9f1b043 Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Thu, 14 Nov 2024 12:07:48 +0000 Subject: [PATCH] Simplifying CSS, fixing light mode toggle button more --- examples/theme_sandbox.py | 4 +--- src/textual/widgets/_switch.py | 17 ----------------- src/textual/widgets/_toggle_button.py | 4 +--- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/examples/theme_sandbox.py b/examples/theme_sandbox.py index 8dedf4df5..8dcc5012a 100644 --- a/examples/theme_sandbox.py +++ b/examples/theme_sandbox.py @@ -364,8 +364,8 @@ class ChangingThemeApp(App[None]): yield Header(show_clock=True, icon="🐟") yield ThemeList(id="theme-list") with VerticalScroll(id="widget-list", can_focus=False) as container: + yield Switch() yield ToggleButton(label="Toggle Button") - yield SelectionList[int]( ("Falken's Maze", 0, True), ("Black Jack", 1), @@ -482,8 +482,6 @@ class ChangingThemeApp(App[None]): "Virgon", ) - yield Switch() - yield Footer() def on_mount(self) -> None: diff --git a/src/textual/widgets/_switch.py b/src/textual/widgets/_switch.py index 37714a62e..5f0dab761 100644 --- a/src/textual/widgets/_switch.py +++ b/src/textual/widgets/_switch.py @@ -72,23 +72,6 @@ class Switch(Widget, can_focus=True): border: tall $border; background-tint: $foreground 5%; } - &:light { - & > .switch--slider { - background: $surface-lighten-2; - color: $surface-darken-1; - } - &.-on { - & > .switch--slider { - color: $success-lighten-1; - } - &:hover > .switch--slider { - color: $success; - } - } - &:hover > .switch--slider { - color: $surface-darken-2; - } - } } """ diff --git a/src/textual/widgets/_toggle_button.py b/src/textual/widgets/_toggle_button.py index 6f5f81cce..8a354294c 100644 --- a/src/textual/widgets/_toggle_button.py +++ b/src/textual/widgets/_toggle_button.py @@ -78,13 +78,11 @@ class ToggleButton(Static, can_focus=True): text-style: $block-cursor-text-style; } } - - &:hover { + &:blur:hover { & > .toggle--label { background: $block-hover-background; } } - } """ # TODO: https://github.com/Textualize/textual/issues/1780