JavaFx Css, 'Not' selector
Asked Answered
C

1

21

the following css would select all cells with 'new' style class and set it's color to green

.table-view .new:filled {
    -fx-background-color: green;
}

but on selection, it stays green, what I want is to respect the usual selection color, so is there something like:

.table-view .new:filled:not(selected){
    -fx-background-color: green;
}

also I've noticed a strange behavior, the following css

.table-view :selected{
    -fx-background-color: yellow;
}

would normally turn selection color of talbe to yellow, where as the following css to set the selection color of updated cells is not working

.table-view .updated:selected{
    -fx-background-color: yellow;
}
Collogue answered 6/9, 2016 at 17:52 Comment(1)
Don't know if that helps, but I was looking for a similar formula when designing the Javafx MenuBar but I solved it with a different approach which is considered here: JavaFX menu css I used different color on the: menu:showing .label . As I said I don't know if that helps but it might.Life
G
0

not was also not working here:

.table-row-cell:not-matching-search-and-groups:not(focused) > .table-cell {
    -fx-text-fill: #ffaa11;
}
.table-row-cell:not-matching-search-and-groups:focused > .table-cell {
    -fx-text-fill: #00ff4c;
}

not working

I then did first put the more general selector - and then, it worked:

.table-row-cell:not-matching-search-and-groups > .table-cell {
    -fx-text-fill: #ffaa11;
}
.table-row-cell:not-matching-search-and-groups:focused > .table-cell {
    -fx-text-fill: #00ff4c;
}

working

Glasswork answered 5/8 at 23:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.