How can you style a ChoiceBox in JavaFX with CSS? The only things I have found out is how to change the background and the text color.
// Background Color
.cb {
-fx-background-color: #HEX;
}
// Text Color
.cb .label {
-fx-text-fill
}

What I am still missing is the highlighting color when hovering the items and the background color of the dropdown list. Also the little arrow. Unfortunately I have found no documentation or anything that helps.
EDIT:
@James_D gave a great link to find out stylings: Modena.css
That way I figured out how to color the white background black.
.cb .context-menu {
-fx-background-color: black;
}
For the highlighting color:
.cb .menu-item:focused {
-fx-background-color: yellow ; /* for example */
}
The background color of the dropdown list:
.cb .context-menu {
-fx-background-color: antiquewhite ;
}
For the arrow:
.cb {
-fx-mark-color: green ;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With