gpt4 book ai didi

javafx - 使用 JavaFx 制作暗模式

转载 作者:行者123 更新时间:2023-12-03 09:52:42 26 4
gpt4 key购买 nike

我想知道是否有一种简单的方法可以使用 JavaFx 和 CSS 制作暗模式。我有一个带有名为“暗模式”的 CheckMenuItem 的 MenuBar,当我单击它时,我希望场景变暗,文本变白。

最佳答案

这是我的。

(更新)上一个太不透明了。

.root { 
-fx-accent: #1e74c6;
-fx-focus-color: -fx-accent;
-fx-base: #373e43;
-fx-control-inner-background: derive(-fx-base, 35%);
-fx-control-inner-background-alt: -fx-control-inner-background ;
}

.label{
-fx-text-fill: lightgray;
}

.text-field {
-fx-prompt-text-fill: gray;
}

.titulo{
-fx-font-weight: bold;
-fx-font-size: 18px;
}

.button{
-fx-focus-traversable: false;
}

.button:hover{
-fx-text-fill: white;
}

.separator *.line {
-fx-background-color: #3C3C3C;
-fx-border-style: solid;
-fx-border-width: 1px;
}

.scroll-bar{
-fx-background-color: derive(-fx-base,45%)
}

.button:default {
-fx-base: -fx-accent ;
}

.table-view{
/*-fx-background-color: derive(-fx-base, 10%);*/
-fx-selection-bar-non-focused: derive(-fx-base, 50%);
}

.table-view .column-header .label{
-fx-alignment: CENTER_LEFT;
-fx-font-weight: none;
}

.list-cell:even,
.list-cell:odd,
.table-row-cell:even,
.table-row-cell:odd{
-fx-control-inner-background: derive(-fx-base, 15%);
}

.list-cell:empty,
.table-row-cell:empty {
-fx-background-color: transparent;
}

.list-cell,
.table-row-cell{
-fx-border-color: transparent;
-fx-table-cell-border-color:transparent;
}

enter image description here

关于javafx - 使用 JavaFx 制作暗模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49159286/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com