As mentioned by @Billie, the best approach is to declare the styling in the CSS and include in SceneBuilder. This way you precisely know what you are styling.
Having said that, the main reason that setting -fx-text-fill on combo-box not working is, that the feature of applying text fills or colors cannot be inherited. Only Font attributes (family, size, style & weight) can be inherited from parent node. Thats why all the font settings on ComboBox are applied on the inner Label but not the -fx-text-fill.
Text fills or colours are applied in the CSS either directly or from a pre defined variable declared at root level.
Below is the styling in modena.css for the ComboBox inner label and arrow:
If you notice the colors are set from the variables -fx-text-base-color and -fx-mark-color respectively. So you can override these variables at ComboBox level so that all its children will then use those values. (Similar to what @jewelsea mentioned in his comment).
2
Answers
One possible way to resolve the issue can be adding a stylesheet to Scene Builder:
Css code might look like this:
As mentioned by @Billie, the best approach is to declare the styling in the CSS and include in SceneBuilder. This way you precisely know what you are styling.
Having said that, the main reason that setting
-fx-text-fill
on combo-box not working is, that the feature of applying text fills or colors cannot be inherited. Only Font attributes (family, size, style & weight) can be inherited from parent node. Thats why all the font settings on ComboBox are applied on the inner Label but not the-fx-text-fill
.Text fills or colours are applied in the CSS either directly or from a pre defined variable declared at root level.
Below is the styling in modena.css for the ComboBox inner label and arrow:
If you notice the colors are set from the variables
-fx-text-base-color
and-fx-mark-color
respectively. So you can override these variables at ComboBox level so that all its children will then use those values. (Similar to what @jewelsea mentioned in his comment).