Skip to content

Commit c245c09

Browse files
committed
Select focus styling
1 parent 579d7f1 commit c245c09

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/textual/design.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def luminosity_range(spread: float) -> Iterable[tuple[str, float]]:
215215
# The surface color for builtin focused widgets
216216
# Use half the luminosity spread in order to land half-way between
217217
# surface and the surface-lighten-1 shade.
218-
colors["surface-active"] = surface.lighten(self.luminosity_spread / 3.5).hex
218+
colors["surface-active"] = surface.lighten(self.luminosity_spread / 2.5).hex
219219

220220
return colors
221221

src/textual/widgets/_select.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,8 @@ class SelectCurrent(Horizontal):
110110

111111
DEFAULT_CSS = """
112112
SelectCurrent {
113-
border: tall transparent;
114-
background: $boost;
115113
color: $text;
116-
width: 100%;
114+
width: 1fr;
117115
height: auto;
118116
padding: 0 2;
119117
@@ -211,18 +209,27 @@ class Select(Generic[SelectType], Vertical, can_focus=True):
211209
DEFAULT_CSS = """
212210
Select {
213211
height: auto;
212+
background: $surface;
213+
border: tall $border-blurred;
214214
215215
& > SelectOverlay {
216216
width: 1fr;
217+
background: $panel;
217218
display: none;
218219
height: auto;
219220
max-height: 12;
220221
overlay: screen;
221222
constrain: none inside;
223+
224+
&:focus {
225+
border: tall $border;
226+
background: $surface-active;
227+
}
222228
}
223229
224-
&:focus > SelectCurrent {
225-
border: tall $accent;
230+
&:focus {
231+
background: $surface-active;
232+
border: tall $border;
226233
}
227234
228235
.up-arrow {
@@ -240,10 +247,6 @@ class Select(Generic[SelectType], Vertical, can_focus=True):
240247
&.-expanded > SelectOverlay {
241248
display: block;
242249
}
243-
244-
&.-expanded > SelectCurrent {
245-
border: tall $accent;
246-
}
247250
}
248251
249252
"""

0 commit comments

Comments
 (0)