JavaFX CSS: Custom Functions

I am wondering if there is a way to add custom functions in JavaFX CSS, what I am primarily interested in is creating a function to get additional color.

Currently, the only color conversion functions are output and ladder.

The problem with using output for this is that it only controls brightness in one direction.

Thanks for any help in advance.

JavaFX Color Reference

+6
source share
1 answer

You can add a list of colors to your main CSS:

style.css

/* Colors -------------- */ *{ -color-primary:#d8d8d8; -color-accent:#F44336; -color-secondary:#1E88E5; -color-dark-primary:#1d1d1d; -color-amber:#ffc400; -color-gray:#666666; } 

And use it anywhere:

 @import "../main/Styles.css"; .background { -fx-background-color: -color-amber; } 
0
source

Source: https://habr.com/ru/post/983059/


All Articles