Skip to content

Commit

Permalink
Global cursor styling
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Oct 21, 2024
1 parent 3164127 commit 2f993da
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 deletions.
6 changes: 5 additions & 1 deletion src/textual/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ def to_color_system(self) -> ColorSystem:
variables={
"block-cursor-background": "#88C0D0",
"block-cursor-foreground": "#2E3440",
"block-cursor-text-style": "bold",
"block-cursor-text-style": "none",
"footer-key-foreground": "#88C0D0",
},
),
"gruvbox": Theme(
Expand All @@ -115,6 +116,9 @@ def to_color_system(self) -> ColorSystem:
surface="#3c3836",
panel="#504945",
dark=True,
variables={
"block-cursor-foreground": "#fbf1c7",
},
),
"solarized-dark": Theme(
name="solarized-dark",
Expand Down
4 changes: 2 additions & 2 deletions src/textual/widgets/_collapsible.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class CollapsibleTitle(Static, can_focus=True):
}
CollapsibleTitle:focus {
background: $secondary;
color: $text;
background: $block-cursor-background;
color: $block-cursor-foreground;
}
"""

Expand Down
2 changes: 1 addition & 1 deletion src/textual/widgets/_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ListView(VerticalScroll, can_focus=True, can_focus_children=False):
ListView {
background: transparent;
& > ListItem.--highlight {
color: $text;
color: $block-cursor-foreground;
background: $block-cursor-blurred-background;
}
&:focus-within {
Expand Down
10 changes: 5 additions & 5 deletions src/textual/widgets/_option_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,25 +144,25 @@ class OptionList(ScrollView, can_focus=True):
border: tall transparent;
padding: 0 1;
background: $surface;
&:focus {
border: tall $border;
background-tint: $foreground 5%;
& > .option-list--option-highlighted {
color: $block-cursor-foreground;
background: $block-cursor-background;
text-style: bold;
text-style: $block-cursor-text-style;
}
}
& > .option-list--option-hover-highlighted {
background: $secondary;
color: $text;
color: $block-cursor-foreground;
background: $block-cursor-background;
}
& > .option-list--separator {
color: $foreground 15%;
}
& > .option-list--option-highlighted {
color: $text;
color: $foreground;
background: $block-cursor-blurred-background;
}
& > .option-list--option-disabled {
Expand Down
2 changes: 1 addition & 1 deletion src/textual/widgets/_radio_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class RadioSet(VerticalScroll, can_focus=True, can_focus_children=False):
& > RadioButton.-selected {
color: $text;
text-style: bold;
text-style: $block-cursor-text-style;
background: $block-cursor-background;
& > .toggle--button {
color: $surface;
Expand Down
4 changes: 2 additions & 2 deletions src/textual/widgets/_toggle_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ToggleButton(Static, can_focus=True):
& > .toggle--label {
color: $text;
background: $block-cursor-background;
text-style: bold;
text-style: $block-cursor-text-style;
}
& > .toggle--button {
background: $foreground 25%;
Expand Down Expand Up @@ -98,7 +98,7 @@ class ToggleButton(Static, can_focus=True):
/* Base button colors (including in dark mode). */
ToggleButton > .toggle--button {
text-style: bold;
text-style: $block-cursor-text-style;
background: $foreground 15%;
}
Expand Down
4 changes: 2 additions & 2 deletions src/textual/widgets/_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,9 @@ class Tree(Generic[TreeDataType], ScrollView, can_focus=True):
&:focus {
background-tint: $foreground 5%;
& > .tree--cursor {
color: $text;
color: $block-cursor-foreground;
background: $block-cursor-background;
text-style: bold;
text-style: $block-cursor-text-style;
}
& > .tree--guides {
color: $surface-lighten-3;
Expand Down

0 comments on commit 2f993da

Please sign in to comment.