Skip to content

Commit

Permalink
Background tint on ToggleButton; use nested CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Oct 14, 2024
1 parent 9af59d6 commit 2ff9d2e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/textual/widgets/_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ class Select(Generic[SelectType], Vertical, can_focus=True):
& > SelectOverlay {
width: 1fr;
background: $panel;
display: none;
height: auto;
max-height: 12;
Expand Down
30 changes: 16 additions & 14 deletions src/textual/widgets/_toggle_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,26 @@ class ToggleButton(Static, can_focus=True):
& > .toggle--button {
color: $surface;
}
}
ToggleButton:focus {
border: tall $border;
}
&:focus {
border: tall $border;
background-tint: $foreground 5%;
& > .toggle--label {
color: $text;
background: $highlight-cursor;
}
& > .toggle--button {
background: $foreground 25%;
}
}
ToggleButton:hover {
background: $highlight-hover;
ToggleButton:hover {
background: $highlight-hover;
}
}
ToggleButton:focus > .toggle--label {
color: $text;
background: $highlight-cursor;
}
/* Base button colors (including in dark mode). */
Expand All @@ -84,10 +90,6 @@ class ToggleButton(Static, can_focus=True):
background: $foreground 15%;
}
ToggleButton:focus > .toggle--button {
background: $foreground 25%;
}
ToggleButton.-on > .toggle--button {
color: $success;
}
Expand Down

0 comments on commit 2ff9d2e

Please sign in to comment.