New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Icons can't be styled via user agent stylesheet #121
Comments
The CSS ins styles.css: .ikonli-font-icon {
-fx-icon-size: 48px;
-fx-icon-color: blue;
-fx-icon-code: mdi-camera;
} |
According to the Javadocs of getUserAgentStylesheet() this should work. We are using this method heavily in ControlsFX, too.
|
Any idea, yet, how this can be fixed / should be fixed? |
Unfortunately no, I've got no clue why it's not working. |
I suspect this to be a JavaFX bug Also in the newer JavaFX versions the documentation has been updated to add:
I wonder if that could be the problem, but I'm just guessing |
@aalmiray @dlemmermann I finally found the issue and an alternative workaround. JavaFX' StyleableProperties have a way to specify the origin of the value, see here Docs Here's the same example @dlemmermann provided, but I built a custom version of ikonli that implements such workaround, you can see the difference by switching the dependencies in gradle. |
Thank you @palexdev! This looks promising. Wonder if it would work as low as JavaFX 11, though with recent version of JavaFX (such as 17) still being binary compatible with Java 11 then I might bump Ikonli all the way to JavaFX 17. |
Ah yes, I like to always use the latest releases |
Thank you guys! |
It seems like it is not possible to style an icon via the "user agent stylesheet" of a custom control (using a skin). When you run the standalone app below you will notice that styling works fine but when you comment out the line
getStylesheets().add(IkonliBug.class.getResource("styles.css").toExternalForm());
then only the user agent stylesheet will be used (returned via the getUserAgentStylesheet() method) and styling no longer works.The text was updated successfully, but these errors were encountered: