Skip to content

Commit ea443a4

Browse files
committed
Consistency
1 parent 582a7cf commit ea443a4

File tree

9 files changed

+40
-34
lines changed

9 files changed

+40
-34
lines changed

src/textual/design.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@
1313
NUMBER_OF_SHADES = 3
1414

1515
# Where no content exists
16-
DEFAULT_DARK_BACKGROUND = "#121212"
16+
DEFAULT_DARK_BACKGROUND = "#1e1e1e"
1717
# What text usually goes on top off
18-
DEFAULT_DARK_SURFACE = "#1e1e1e"
18+
DEFAULT_DARK_SURFACE = "#232323"
19+
# TODO - update this
20+
# # Where no content exists
21+
# DEFAULT_DARK_BACKGROUND = "#121212"
22+
# # What text usually goes on top off
23+
# DEFAULT_DARK_SURFACE = "#1e1e1e"
1924

2025
DEFAULT_LIGHT_SURFACE = "#f5f5f5"
2126
DEFAULT_LIGHT_BACKGROUND = "#efefef"
@@ -193,7 +198,7 @@ def luminosity_range(spread) -> Iterable[tuple[str, float]]:
193198
# The cursor color for widgets such as OptionList, DataTable, etc.
194199
colors["cursor"] = accent.hex
195200
# The cursor should dim when the widget is blurred.
196-
colors["cursor-blurred"] = accent.with_alpha(0.4).hex
201+
colors["cursor-blurred"] = accent.with_alpha(0.3).hex
197202

198203
# The border color for focused widgets which have a border.
199204
colors["border"] = accent.hex

src/textual/screen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class Screen(Generic[ScreenResultType], Widget):
150150
151151
layout: vertical;
152152
overflow-y: auto;
153-
background: $surface;
153+
background: $background;
154154
155155
&:inline {
156156
height: auto;

src/textual/widget.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ class Widget(DOMNode):
280280
scrollbar-background-hover: $panel-darken-2;
281281
scrollbar-background-active: $panel-darken-3;
282282
scrollbar-color: $primary-lighten-1;
283-
scrollbar-color-active: $warning-darken-1;
284-
scrollbar-color-hover: $primary-lighten-1;
283+
scrollbar-color-active: $secondary;
284+
scrollbar-color-hover: $primary-lighten-2;
285285
scrollbar-corner-color: $panel-darken-1;
286286
scrollbar-size-vertical: 2;
287287
scrollbar-size-horizontal: 1;

src/textual/widgets/_data_table.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,14 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
314314
"""
315315

316316
DEFAULT_CSS = """
317-
DataTable:dark {
318-
background: initial;
319-
}
320317
DataTable {
321-
background: $surface ;
318+
background: $surface;
322319
color: $text;
323320
height: auto;
324321
max-height: 100%;
325322
326323
&:dark {
327-
background: initial;
324+
background: $surface;
328325
& > .datatable--even-row {
329326
background: $primary 15%;
330327
}

src/textual/widgets/_input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class Input(Widget, can_focus=True):
146146

147147
DEFAULT_CSS = """
148148
Input {
149-
background: $boost;
149+
background: $surface;
150150
color: $text;
151151
padding: 0 2;
152152
border: tall $border-blurred;

src/textual/widgets/_list_item.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,22 @@ class ListItem(Widget, can_focus=False):
1616
documentation for more details on use.
1717
"""
1818

19-
SCOPED_CSS = False
20-
2119
DEFAULT_CSS = """
2220
ListItem {
2321
color: $text;
2422
height: auto;
25-
background: $background;
2623
overflow: hidden hidden;
27-
}
28-
ListItem > :disabled {
29-
background: $background;
30-
}
31-
ListItem > Widget :hover {
32-
background: $hover;
33-
}
34-
ListView > ListItem.--highlight {
35-
background: $cursor-blurred;
36-
}
37-
ListView:focus > ListItem.--highlight {
38-
background: $cursor;
39-
}
40-
ListItem > Widget {
41-
height: auto;
24+
background: $surface;
25+
26+
& > :disabled {
27+
background: $background;
28+
}
29+
& > Widget {
30+
height: auto;
31+
& :hover {
32+
background: $hover;
33+
}
34+
}
4235
}
4336
"""
4437

src/textual/widgets/_list_view.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ class ListView(VerticalScroll, can_focus=True, can_focus_children=False):
2525
index: The index in the list that's currently highlighted.
2626
"""
2727

28+
DEFAULT_CSS = """
29+
ListView {
30+
background: transparent;
31+
& > ListItem.--highlight {
32+
background: $cursor-blurred;
33+
}
34+
&:focus > ListItem.--highlight {
35+
background: $cursor;
36+
}
37+
}
38+
"""
39+
2840
BINDINGS: ClassVar[list[BindingType]] = [
2941
Binding("enter", "select_cursor", "Select", show=False),
3042
Binding("up", "cursor_up", "Cursor up", show=False),

src/textual/widgets/_option_list.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class OptionList(ScrollView, can_focus=True):
143143
overflow-x: hidden;
144144
border: tall transparent;
145145
padding: 0 1;
146+
background: $surface ;
146147
}
147148
148149
OptionList:focus {
@@ -155,7 +156,7 @@ class OptionList(ScrollView, can_focus=True):
155156
156157
OptionList > .option-list--option-highlighted {
157158
color: $text;
158-
text-style: bold;
159+
background: $cursor-blurred;
159160
}
160161
161162
OptionList:focus > .option-list--option-highlighted {
@@ -173,13 +174,11 @@ class OptionList(ScrollView, can_focus=True):
173174
OptionList > .option-list--option-hover-highlighted {
174175
background: $accent 60%;
175176
color: $text;
176-
text-style: bold;
177177
}
178178
179179
OptionList:focus > .option-list--option-hover-highlighted {
180180
background: $accent;
181181
color: $text;
182-
text-style: bold;
183182
}
184183
"""
185184

src/textual/widgets/_text_area.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class TextArea(ScrollView):
9393
height: 1fr;
9494
border: tall $background;
9595
padding: 0 1;
96-
96+
background: $surface;
9797
& .text-area--gutter {
9898
color: $text 40%;
9999
}

0 commit comments

Comments
 (0)