Skip to content

Commit

Permalink
Renaming variables, ensuring selectionlist is readable on light mode
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Oct 9, 2024
1 parent b505405 commit b997b39
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/textual/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ def luminosity_range(spread) -> Iterable[tuple[str, float]]:
colors["text-disabled"] = "ansi_default"

# The cursor color for widgets such as OptionList, DataTable, etc.
colors["cursor"] = accent.hex
colors["highlight-cursor"] = accent.hex
# The cursor should dim when the widget is blurred.
colors["cursor-blurred"] = accent.with_alpha(0.3).hex
colors["highlight-cursor-blurred"] = accent.with_alpha(0.3).hex

# The border color for focused widgets which have a border.
colors["border"] = accent.hex
Expand All @@ -208,7 +208,7 @@ def luminosity_range(spread) -> Iterable[tuple[str, float]]:
# Widgets such as OptionList, DataTable, etc. have a "hover cursor"
# which gives a subtle highlight behind the option under the mouse
# cursor is under.
colors["hover"] = boost.with_alpha(0.06).hex
colors["highlight-hover"] = boost.with_alpha(0.06).hex

return colors

Expand Down
8 changes: 4 additions & 4 deletions src/textual/widgets/_data_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,17 +347,17 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
}
& > .datatable--cursor {
background: $cursor-blurred;
background: $highlight-cursor-blurred;
color: $text;
}
&:focus > .datatable--cursor {
background: $cursor;
background: $highlight-cursor;
color: $text;
}
& > .datatable--fixed-cursor {
background: $cursor 92%;
background: $highlight-cursor 92%;
color: $text;
}
Expand All @@ -371,7 +371,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
}
& > .datatable--hover {
background: $hover;
background: $highlight-hover;
}
}
"""
Expand Down
2 changes: 1 addition & 1 deletion src/textual/widgets/_list_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ListItem(Widget, can_focus=False):
& > Widget {
height: auto;
& :hover {
background: $hover;
background: $highlight-hover;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/textual/widgets/_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ class ListView(VerticalScroll, can_focus=True, can_focus_children=False):
ListView {
background: transparent;
& > ListItem.--highlight {
background: $cursor-blurred;
background: $highlight-cursor-blurred;
}
&:focus > ListItem.--highlight {
background: $cursor;
background: $highlight-cursor;
}
}
"""
Expand Down
6 changes: 3 additions & 3 deletions src/textual/widgets/_option_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,19 @@ class OptionList(ScrollView, can_focus=True):
OptionList > .option-list--option-highlighted {
color: $text;
background: $cursor-blurred;
background: $highlight-cursor-blurred;
}
OptionList:focus > .option-list--option-highlighted {
background: $cursor;
background: $highlight-cursor;
}
OptionList > .option-list--option-disabled {
color: $text-disabled;
}
OptionList > .option-list--option-hover {
background: $hover;
background: $highlight-hover;
}
OptionList > .option-list--option-hover-highlighted {
Expand Down
6 changes: 3 additions & 3 deletions src/textual/widgets/_selection_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ class SelectionList(Generic[SelectionType], OptionList):
&:light {
& > .selection-list--button-selected-highlighted {
color: $primary;
color: $success;
}
&:focus {
& > .selection-list--button-selected {
color: $primary;
color: $success-darken-1;
}
& > .selection-list--button-selected-highlighted {
color: $primary;
color: $success-darken-1;
}
}
}
Expand Down

0 comments on commit b997b39

Please sign in to comment.