问题描述
从我正在阅读的内容中,可以通过CSS编写JavaFX2外观.但是我似乎找不到任何完整的示例,这里和那里的一些教程,仅此而已.具体来说,我正在寻找JavaFX2的深色"皮肤.有什么想法可以找到预制皮吗?
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?
推荐答案
如果您阅读 modena.css ,您将看到有关颜色值的解释源自
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
您只需在.root中添加一些CSS即可覆盖基本颜色,这是其中的一些.
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;
只需执行.root{-fx-base:#000000;}
即可创建一个可读的深色主题,该主题可能需要进行一些调整.
Just doing .root{-fx-base:#000000;}
makes a readable dark theme that could use some tweaking.
这篇关于是否有JavaFX2的预制皮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!