Skip to content

Commit

Permalink
Fixing colors in select widget
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Oct 17, 2024
1 parent 2a13416 commit 0d1def6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/textual/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ def luminosity_range(spread: float) -> Iterable[tuple[str, float]]:
colors["text-muted"] = "ansi_default"
colors["text-disabled"] = "ansi_default"

# Foreground colors
colors["foreground-muted"] = get(
"foreground-muted", foreground.with_alpha(0.6).hex
)
colors["foreground-disabled"] = get(
"foreground-disabled", foreground.with_alpha(0.38).hex
)

# The cursor color for widgets such as OptionList, DataTable, etc.
colors["block-cursor-foreground"] = get(
"block-cursor-foreground", colors["text"]
Expand Down
12 changes: 7 additions & 5 deletions src/textual/widgets/_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class SelectOverlay(OptionList):
SelectOverlay {
border: tall $border-blurred;
background: $surface;
color: $text;
color: $foreground;
width: 100%;
padding: 0 1;
}
Expand Down Expand Up @@ -110,7 +110,7 @@ class SelectCurrent(Horizontal):

DEFAULT_CSS = """
SelectCurrent {
color: $text;
color: $foreground;
width: 1fr;
height: auto;
padding: 0 2;
Expand All @@ -123,20 +123,20 @@ class SelectCurrent(Horizontal):
Static#label {
width: 1fr;
height: auto;
color: $text-disabled;
color: $foreground 50%;
background: transparent;
}
&.-has-value Static#label {
color: $text;
color: $foreground;
}
.arrow {
box-sizing: content-box;
width: 1;
height: 1;
padding: 0 0 0 1;
color: $text-muted;
color: $foreground 50%;
background: transparent;
}
}
Expand Down Expand Up @@ -214,6 +214,7 @@ class Select(Generic[SelectType], Vertical, can_focus=True):
DEFAULT_CSS = """
Select {
height: auto;
color: $foreground;
background: $surface;
border: tall $border-blurred;
Expand All @@ -233,6 +234,7 @@ class Select(Generic[SelectType], Vertical, can_focus=True):
max-height: 12;
overlay: screen;
constrain: none inside;
color: $foreground;
&:focus {
border: tall $border;
Expand Down

0 comments on commit 0d1def6

Please sign in to comment.