Skip to content

Commit b41f346

Browse files
committed
Tree styling
1 parent c245c09 commit b41f346

File tree

3 files changed

+33
-24
lines changed

3 files changed

+33
-24
lines changed

src/textual/design.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ def luminosity_range(spread: float) -> Iterable[tuple[str, float]]:
213213
colors["highlight-hover"] = boost.with_alpha(0.05).hex
214214

215215
# The surface color for builtin focused widgets
216-
# Use half the luminosity spread in order to land half-way between
217-
# surface and the surface-lighten-1 shade.
218216
colors["surface-active"] = surface.lighten(self.luminosity_spread / 2.5).hex
219217

220218
return colors

src/textual/widgets/_select.py

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ class SelectCurrent(Horizontal):
115115
height: auto;
116116
padding: 0 2;
117117
118+
&:ansi {
119+
color: ansi_default;
120+
background: ansi_default;
121+
}
122+
118123
Static#label {
119124
width: 1fr;
120125
height: auto;
@@ -211,6 +216,15 @@ class Select(Generic[SelectType], Vertical, can_focus=True):
211216
height: auto;
212217
background: $surface;
213218
border: tall $border-blurred;
219+
220+
.up-arrow {
221+
display: none;
222+
}
223+
224+
&:focus {
225+
background: $surface-active;
226+
border: tall $border;
227+
}
214228
215229
& > SelectOverlay {
216230
width: 1fr;
@@ -227,26 +241,20 @@ class Select(Generic[SelectType], Vertical, can_focus=True):
227241
}
228242
}
229243
230-
&:focus {
231-
background: $surface-active;
232-
border: tall $border;
233-
}
234-
235-
.up-arrow {
236-
display: none;
237-
}
244+
&.-expanded {
245+
.down-arrow {
246+
display: none;
247+
}
238248
239-
&.-expanded .down-arrow {
240-
display: none;
241-
}
249+
.up-arrow {
250+
display: block;
251+
}
242252
243-
&.-expanded .up-arrow {
244-
display: block;
253+
& > SelectOverlay {
254+
display: block;
255+
}
245256
}
246257
247-
&.-expanded > SelectOverlay {
248-
display: block;
249-
}
250258
}
251259
252260
"""

src/textual/widgets/_tree.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -588,13 +588,13 @@ class Tree(Generic[TreeDataType], ScrollView, can_focus=True):
588588
589589
}
590590
& > .tree--guides {
591-
color: $surface-lighten-1;
591+
color: $surface-lighten-2;
592592
}
593593
& > .tree--guides-hover {
594-
color: $surface-lighten-1;
594+
color: $surface-lighten-2;
595595
}
596596
& > .tree--guides-selected {
597-
color: $primary;
597+
color: $highlight-cursor-blurred;
598598
}
599599
& > .tree--cursor {
600600
background: $highlight-cursor-blurred;
@@ -603,19 +603,22 @@ class Tree(Generic[TreeDataType], ScrollView, can_focus=True):
603603
& > .tree--highlight {
604604
}
605605
& > .tree--highlight-line {
606-
background: $boost;
606+
background: $highlight-hover;
607607
}
608608
609609
&:focus {
610610
background: $surface-active;
611611
& > .tree--cursor {
612612
background: $highlight-cursor;
613613
}
614+
& > .tree--guides {
615+
color: $surface-lighten-3;
616+
}
614617
& > .tree--guides-hover {
615-
color: $surface-lighten-2;
618+
color: $surface-lighten-3;
616619
}
617620
& > .tree--guides-selected {
618-
color: $surface-lighten-2;
621+
color: $highlight-cursor;
619622
}
620623
}
621624

0 commit comments

Comments
 (0)