Reputation: 2930
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;
}
Upvotes: 3
Views: 5964
Reputation: 209358
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 ;
}
Upvotes: 2