From b997b398d25630fb790519d9180a04a33953a274 Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Wed, 9 Oct 2024 11:49:17 +0100 Subject: [PATCH] Renaming variables, ensuring selectionlist is readable on light mode --- src/textual/design.py | 6 +++--- src/textual/widgets/_data_table.py | 8 ++++---- src/textual/widgets/_list_item.py | 2 +- src/textual/widgets/_list_view.py | 4 ++-- src/textual/widgets/_option_list.py | 6 +++--- src/textual/widgets/_selection_list.py | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/textual/design.py b/src/textual/design.py index a09b7531a2..232cfda707 100644 --- a/src/textual/design.py +++ b/src/textual/design.py @@ -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 @@ -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 diff --git a/src/textual/widgets/_data_table.py b/src/textual/widgets/_data_table.py index 57cc6ceeb2..888dd0453c 100644 --- a/src/textual/widgets/_data_table.py +++ b/src/textual/widgets/_data_table.py @@ -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; } @@ -371,7 +371,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True): } & > .datatable--hover { - background: $hover; + background: $highlight-hover; } } """ diff --git a/src/textual/widgets/_list_item.py b/src/textual/widgets/_list_item.py index 166d2f1ca9..a43a74238a 100644 --- a/src/textual/widgets/_list_item.py +++ b/src/textual/widgets/_list_item.py @@ -29,7 +29,7 @@ class ListItem(Widget, can_focus=False): & > Widget { height: auto; & :hover { - background: $hover; + background: $highlight-hover; } } } diff --git a/src/textual/widgets/_list_view.py b/src/textual/widgets/_list_view.py index 05d9272190..dba5d8125e 100644 --- a/src/textual/widgets/_list_view.py +++ b/src/textual/widgets/_list_view.py @@ -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; } } """ diff --git a/src/textual/widgets/_option_list.py b/src/textual/widgets/_option_list.py index 11659b8a71..e6ed978b6d 100644 --- a/src/textual/widgets/_option_list.py +++ b/src/textual/widgets/_option_list.py @@ -156,11 +156,11 @@ 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 { @@ -168,7 +168,7 @@ class OptionList(ScrollView, can_focus=True): } OptionList > .option-list--option-hover { - background: $hover; + background: $highlight-hover; } OptionList > .option-list--option-hover-highlighted { diff --git a/src/textual/widgets/_selection_list.py b/src/textual/widgets/_selection_list.py index 06fd7344b6..8c7acc2ce7 100644 --- a/src/textual/widgets/_selection_list.py +++ b/src/textual/widgets/_selection_list.py @@ -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; } } }