JavaFX 8 DatePicker Style
How can I change the style of a calendar in a DatePicker in JavaFX 8? I've looked through all the default styles in the modena file and I don't find the DatePicker classes. Does anyone know how to do this? For example, change the title color to blue.
The default is the following style:
source to share
You can find the css for the control DatePicker
in the style classes .date-picker
and .date-picker-popup
in the modena.css file.
If you want to change the title (I think you mean the top bar with month and year) this is what you need:
.date-picker-popup > .month-year-pane {
-fx-padding: 0.588883em 0.5em 0.666667em 0.5em; /* 7 6 8 6 */
-fx-background-color: derive(-fx-box-border,30%),
linear-gradient(to bottom, derive(-fx-base,-3%),
derive(-fx-base,5%) 50%,
derive(-fx-base,-3%));
-fx-background-insets: 0 0 0 0, 0 0 1 0;
}
You just need to add this style class to your css file and change -fx-base
to the color you want .
source to share