Are there any pre-made skins for JavaFX2?

房东的猫 提交于 2019-12-25 06:32:10

问题


From what I'm reading it's possible to write JavaFX2 skins via CSS. But I can't seem to find any complete examples of this, a few tutorials here and there, but that's it. Specifically I'm looking for a "dark" skin for JavaFX2. Any ideas of where to find pre-made skins?


回答1:


If you read modena.css you'll see an explanation where colors values are derived from

 * -fx-text-base-color for text on top of -fx-base, -fx-color, and -fx-body-color
 * -fx-text-background-color for text on top of -fx-background
 * -fx-text-inner-color for text on top of -fx-control-inner-color
 * -fx-selection-bar-text for text on top of -fx-selection-bar

You can just add some css to .root to override the base colors, here's some of theirs.

.root {
-fx-base: #ececec;
-fx-background: derive(-fx-base,26.4%);
-fx-color: -fx-base;
-fx-text-base-color: ladder(
    -fx-color,
    -fx-light-text-color 45%,
    -fx-dark-text-color  46%,
    -fx-dark-text-color  59%,
    -fx-mid-text-color   60%
);
-fx-background-color: -fx-background;

Just doing .root{-fx-base:#000000;} makes a readable dark theme that could use some tweaking.



来源:https://stackoverflow.com/questions/23163622/are-there-any-pre-made-skins-for-javafx2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!