Various DataTable style fixes - fix text colors, fixed header styling in themes

This commit is contained in:
Darren Burns
2024-11-11 12:29:55 +00:00
parent e3d0fd268c
commit fb7fb60574
2 changed files with 16 additions and 5 deletions

View File

@@ -436,6 +436,8 @@ class ChangingThemeApp(App[None]):
table.add_columns(*HEADERS)
table.add_rows(ROWS)
table.zebra_stripes = True
table.fixed_columns = 1
table.cursor_type = "row"
yield table
yield ListView(
ListItem(Label("One")),

View File

@@ -320,6 +320,10 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
height: auto;
max-height: 100%;
&.datatable--fixed-cursor {
background: $block-cursor-blurred-background;
}
&:focus {
background-tint: $foreground 5%;
& > .datatable--cursor {
@@ -331,12 +335,17 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
& > .datatable--header {
background-tint: $foreground 5%;
}
& > .datatable--fixed-cursor {
color: $block-cursor-foreground;
background: $block-cursor-background;
}
}
&:dark {
background: $surface;
& > .datatable--even-row {
background: $surface-lighten-1 50%;
background: $surface-darken-1 40%;
}
}
@@ -352,7 +361,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
& > .datatable--fixed {
background: $secondary 50%;
color: $text;
color: $foreground;
}
& > .datatable--odd-row {
@@ -370,13 +379,13 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
}
& > .datatable--fixed-cursor {
background: $block-cursor-background;
color: $text;
background: $block-cursor-blurred-background;
color: $foreground;
}
& > .datatable--header-cursor {
background: $accent-darken-1;
color: $text;
color: $foreground;
}
& > .datatable--header-hover {