Input cursor styling

This commit is contained in:
Darren Burns
2024-10-21 15:43:25 +01:00
parent 0b7cd1cd78
commit b1f59f9045
6 changed files with 10 additions and 8 deletions

View File

@@ -307,6 +307,7 @@ class ChangingThemeApp(App[None]):
yield Footer()
def on_mount(self) -> None:
self.theme = "nord"
text_area = self.query_one(TextArea)
text_area.selection = Selection((0, 0), (1, 10))

View File

@@ -101,6 +101,8 @@ BUILTIN_THEMES: dict[str, Theme] = {
"block-cursor-foreground": "#2E3440",
"block-cursor-text-style": "none",
"footer-key-foreground": "#88C0D0",
"input-cursor-foreground": "#2E3440",
"input-cursor-background": "#88C0D0",
},
),
"gruvbox": Theme(

View File

@@ -158,9 +158,8 @@ class Input(Widget, can_focus=True):
background-tint: $foreground 5%;
}
&>.input--cursor {
background: $surface;
color: $foreground;
text-style: reverse;
background: $input-cursor-background;
color: $input-cursor-foreground;
}
&>.input--placeholder, &>.input--suggestion {
color: $text-disabled;

View File

@@ -66,7 +66,7 @@ class RadioSet(VerticalScroll, can_focus=True, can_focus_children=False):
background-tint: $foreground 5%;
& > RadioButton.-selected {
color: $text;
color: $block-cursor-foreground;
text-style: $block-cursor-text-style;
background: $block-cursor-background;
& > .toggle--button {

View File

@@ -118,13 +118,13 @@ TextArea {
}
&:focus {
border: tall $secondary;
border: tall $border;
}
&:dark {
.text-area--cursor {
color: $text 90%;
background: $foreground 90%;
color: $input-cursor-foreground;
background: $input-cursor-background;
}
&.-read-only .text-area--cursor {
background: $warning-darken-1;

View File

@@ -67,7 +67,7 @@ class ToggleButton(Static, can_focus=True):
border: tall $border;
background-tint: $foreground 5%;
& > .toggle--label {
color: $text;
color: $block-cursor-foreground;
background: $block-cursor-background;
text-style: $block-cursor-text-style;
}