Skip to content

Commit 2ff9d2e

Browse files
committed
Background tint on ToggleButton; use nested CSS
1 parent 9af59d6 commit 2ff9d2e

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

Diff for: src/textual/widgets/_select.py

-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ class Select(Generic[SelectType], Vertical, can_focus=True):
228228
229229
& > SelectOverlay {
230230
width: 1fr;
231-
background: $panel;
232231
display: none;
233232
height: auto;
234233
max-height: 12;

Diff for: src/textual/widgets/_toggle_button.py

+16-14
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,26 @@ class ToggleButton(Static, can_focus=True):
6262
& > .toggle--button {
6363
color: $surface;
6464
}
65-
}
6665
67-
ToggleButton:focus {
68-
border: tall $border;
69-
}
66+
&:focus {
67+
border: tall $border;
68+
background-tint: $foreground 5%;
69+
& > .toggle--label {
70+
color: $text;
71+
background: $highlight-cursor;
72+
}
73+
& > .toggle--button {
74+
background: $foreground 25%;
75+
}
76+
}
7077
71-
ToggleButton:hover {
72-
background: $highlight-hover;
78+
ToggleButton:hover {
79+
background: $highlight-hover;
80+
}
7381
}
7482
75-
ToggleButton:focus > .toggle--label {
76-
color: $text;
77-
background: $highlight-cursor;
78-
}
83+
84+
7985
8086
/* Base button colors (including in dark mode). */
8187
@@ -84,10 +90,6 @@ class ToggleButton(Static, can_focus=True):
8490
background: $foreground 15%;
8591
}
8692
87-
ToggleButton:focus > .toggle--button {
88-
background: $foreground 25%;
89-
}
90-
9193
ToggleButton.-on > .toggle--button {
9294
color: $success;
9395
}

0 commit comments

Comments
 (0)