I am having trouble setting the background color of the rows in a TableView and also setting the text color using CSS. I would like the following
* CSS for setting the row color (both odd and even)
* CSS for setting the font color for the rows
* CSS for setting the selected row's background color & font
This code doesn't seem to work...
.table-row-cell {
-fx-background-color: black;
-fx-background-insets: 0, 0 0 1 0;
-fx-text-fill: white;
}
.table-row-cell:odd {
-fx-background-color: -fx-table-cell-border-color, derive(-fx-control-inner-background,-5%);
-fx-background-insets: 0, 0 0 1 0;
-fx-text-fill: white;
}
I found this css below which seems to work for the selected row. Is this correct?
.table-view:focused .table-row-cell:filled:focused:selected {
-fx-background-color: -fx-focus-color, -fx-cell-focus-inner-border, -fx-selection-bar;
-fx-background-insets: 0, 1, 2;
-fx-background: -fx-accent;
-fx-text-fill: -fx-selection-bar-text;
}