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_columns(*HEADERS)
table.add_rows(ROWS) table.add_rows(ROWS)
table.zebra_stripes = True table.zebra_stripes = True
table.fixed_columns = 1
table.cursor_type = "row"
yield table yield table
yield ListView( yield ListView(
ListItem(Label("One")), ListItem(Label("One")),

View File

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