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.