JavaFX CSS: custom functions
•
Java
I want to know if there is a way to add custom functions to JavaFX CSS. My main purpose is to create a function to get complementary colors
At present, the only color conversion functions are derivation and ladder diagram
The problem with using derivation is that it only adjusts brightness and is in one direction
Thank you for any help in advance
JavaFX Color Reference
Solution
You can add a list of colors to the main CSS:
style. CSS file
/* 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; }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码