Fix cell selection color for VirtualFlow based controls (#15)

This commit is contained in:
mkpaz 2022-10-07 22:23:48 +04:00
parent 52d96a7fca
commit c77dec332f

@ -7,6 +7,8 @@ $color-cell-bg: -color-bg-default !default;
$color-cell-fg: -color-fg-default !default; $color-cell-fg: -color-fg-default !default;
$color-cell-bg-selected: if(cfg.$darkMode, -color-base-6, -color-base-1) !default; $color-cell-bg-selected: if(cfg.$darkMode, -color-base-6, -color-base-1) !default;
$color-cell-fg-selected: -color-fg-default !default; $color-cell-fg-selected: -color-fg-default !default;
$color-cell-bg-selected-focused: $color-cell-bg-selected !default;
$color-cell-fg-selected-focused: $color-cell-fg-selected !default;
$color-cell-bg-odd: -color-bg-subtle !default; $color-cell-bg-odd: -color-bg-subtle !default;
$color-cell-border: -color-border-default !default; $color-cell-border: -color-border-default !default;
$color-disclosure: -color-fg-muted !default; $color-disclosure: -color-fg-muted !default;
@ -50,6 +52,8 @@ $tree-cell-indent: 1.2em !default; // default JavaFX values is 18px
-color-cell-fg: $color-cell-fg; -color-cell-fg: $color-cell-fg;
-color-cell-bg-selected: $color-cell-bg-selected; -color-cell-bg-selected: $color-cell-bg-selected;
-color-cell-fg-selected: $color-cell-fg-selected; -color-cell-fg-selected: $color-cell-fg-selected;
-color-cell-bg-selected-focused: $color-cell-bg-selected-focused;
-color-cell-fg-selected-focused: $color-cell-fg-selected-focused;
-color-cell-bg-odd: $color-cell-bg-odd; -color-cell-bg-odd: $color-cell-bg-odd;
-color-cell-border: $color-cell-border; -color-cell-border: $color-cell-border;
-color-disclosure: $color-disclosure; -color-disclosure: $color-disclosure;
@ -77,22 +81,33 @@ $tree-cell-indent: 1.2em !default; // default JavaFX values is 18px
} }
// row selection (cellSelectionEnabled = false) // row selection (cellSelectionEnabled = false)
.list-view>.virtual-flow>.clipped-container>.sheet>.list-cell:filled:selected,
.tree-view>.virtual-flow>.clipped-container>.sheet>.tree-cell:filled:selected,
.table-view>.virtual-flow>.clipped-container>.sheet>.table-row-cell:filled:selected,
.tree-table-view>.virtual-flow>.clipped-container>.sheet>.tree-table-row-cell:filled:selected {
-color-cell-fg: -color-cell-fg-selected;
-fx-background-color: -color-cell-border, -color-cell-bg-selected;
}
.list-view:focused>.virtual-flow>.clipped-container>.sheet>.list-cell:filled:selected, .list-view:focused>.virtual-flow>.clipped-container>.sheet>.list-cell:filled:selected,
.tree-view:focused>.virtual-flow>.clipped-container>.sheet>.tree-cell:filled:selected, .tree-view:focused>.virtual-flow>.clipped-container>.sheet>.tree-cell:filled:selected,
.table-view:focused>.virtual-flow>.clipped-container>.sheet>.table-row-cell:filled:selected, .table-view:focused>.virtual-flow>.clipped-container>.sheet>.table-row-cell:filled:selected,
.tree-table-view:focused>.virtual-flow>.clipped-container>.sheet>.tree-table-row-cell:filled:selected { .tree-table-view:focused>.virtual-flow>.clipped-container>.sheet>.tree-table-row-cell:filled:selected {
-color-cell-fg: -color-cell-fg-selected; -color-cell-fg: -color-cell-fg-selected-focused;
-fx-background-color: -color-cell-border, -color-cell-bg-selected; -fx-background-color: -color-cell-border, -color-cell-bg-selected-focused;
} }
// individual cell selection (cellSelectionEnabled = true) // individual cell selection (cellSelectionEnabled = true)
.table-view:focused>.virtual-flow>.clipped-container>.sheet>.table-row-cell .table-cell:selected, .table-view>.virtual-flow>.clipped-container>.sheet>.table-row-cell .table-cell:selected,
.tree-table-view:focused>.virtual-flow>.clipped-container>.sheet>.tree-table-row-cell .tree-table-cell:selected { .tree-table-view>.virtual-flow>.clipped-container>.sheet>.tree-table-row-cell .tree-table-cell:selected {
-fx-background-color: -color-cell-bg-selected; -fx-background-color: -color-cell-bg-selected;
// a margin to show bottom .table-row-cell border, // a margin to show bottom .table-row-cell border,
// it should be 1px height, but for some reason it's not enough // it should be 1px height, but for some reason it's not enough
-fx-background-insets: 0 0 2 0; -fx-background-insets: 0 0 2 0;
} }
.table-view:focused>.virtual-flow>.clipped-container>.sheet>.table-row-cell .table-cell:selected,
.tree-table-view:focused>.virtual-flow>.clipped-container>.sheet>.tree-table-row-cell .tree-table-cell:selected {
-fx-background-color: -color-cell-bg-selected-focused;
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Customised CSS for controls placed directly within cells // // Customised CSS for controls placed directly within cells //