Skip to content

Commit

Permalink
Remove ToggleButton styling switcheroo
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Oct 14, 2024
1 parent c0e3d69 commit 7e6911b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
23 changes: 9 additions & 14 deletions src/textual/widgets/_radio_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ class RadioSet(VerticalScroll, can_focus=True, can_focus_children=False):
& > RadioButton {
background: transparent;
border: none;
padding: 0 1;
padding: 0;
}
& > RadioButton.-selected {
color: $text;
background: $highlight-cursor-blurred;
& > .toggle--button {
color: $surface;
background: $foreground 15%;
}
}
& .toggle--button {
Expand All @@ -59,29 +64,19 @@ class RadioSet(VerticalScroll, can_focus=True, can_focus_children=False):
*/
border: tall $border;
& .toggle--button {
color: $surface;
background: $panel-lighten-1;
}
& > RadioButton.-selected {
color: $text;
background: $highlight-cursor;
& > .toggle--label {
background: $highlight-cursor;
& > .toggle--button {
color: $surface;
background: $panel-lighten-1;
}
&.-on > .toggle--button {
color: $success;
background: $panel-lighten-1;
}
}
& ToggleButton.-selected > .toggle--button {
color: $surface;
background: $panel-lighten-1;
}
}
}
"""
Expand Down
7 changes: 0 additions & 7 deletions src/textual/widgets/_toggle_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,6 @@ def _button(self) -> Text:
# Grab the button style.
button_style = self.get_component_rich_style("toggle--button")

# If the button is off, we're going to do a bit of a switcharound to
# make it look like it's a "cutout".
if not self.value:
button_style += Style.from_color(
self.background_colors[1].rich_color, button_style.bgcolor
)

# Building the style for the side characters. Note that this is
# sensitive to the type of character used, so pay attention to
# BUTTON_LEFT and BUTTON_RIGHT.
Expand Down

0 comments on commit 7e6911b

Please sign in to comment.