black popups with light background in dark mode

This commit is contained in:
woodser 2025-05-18 15:43:39 -04:00
parent a0fdb482e3
commit 1cd74acf2e
No known key found for this signature in database
GPG key ID: 55A10DD48ADEE5EF
8 changed files with 42 additions and 48 deletions

View file

@ -1386,14 +1386,26 @@ textfield */
}
.text-area-popup {
-fx-border-color: -bs-color-background-popup;
-fx-border-color: -bs-color-background-popup-overlay;
}
.text-area-popup .content {
-fx-background-color: -bs-color-background-popup;
-fx-background-color: -bs-color-background-popup-overlay;
}
.text-area-popup:focused {
-fx-faint-focus-color: -bs-color-background-popup-overlay;
}
.notification-popup-bg .text-area-popup, .peer-info-popup-bg .text-area-popup {
-fx-border-color: -bs-color-background-popup;
}
.notification-popup-bg .text-area-popup .content, .peer-info-popup-bg .text-area-popup .content{
-fx-background-color: -bs-color-background-popup;
}
.notification-popup-bg .text-area-popup:focused, .peer-info-popup-bg .text-area-popup:focused {
-fx-faint-focus-color: -bs-color-background-popup;
}
@ -1925,10 +1937,10 @@ textfield */
-fx-background-color: -bs-content-background-gray;
-fx-background-radius: 5;
-fx-effect: null;
-fx-effect: dropshadow(gaussian, -bs-color-gray-10, 10, 0, 0, 0);
-fx-background-insets: 10;
-fx-background-radius: 15;
-fx-border-radius: 15;
-fx-padding: 35, 40, 30, 40;
}
/********************************************************************************************************************
@ -2203,7 +2215,18 @@ textfield */
-fx-text-fill: -bs-rd-error-red;
}
.popup-bg, .notification-popup-bg, .peer-info-popup-bg {
.popup-bg {
-fx-font-size: 1.077em;
-fx-background-color: -bs-color-background-popup-overlay;
-fx-background-radius: 5;
-fx-effect: null;
-fx-background-insets: 10;
-fx-background-radius: 15;
-fx-border-radius: 15;
-fx-padding: 35, 40, 30, 40;
}
.notification-popup-bg, .peer-info-popup-bg {
-fx-font-size: 1.077em;
-fx-text-fill: -bs-rd-font-dark;
-fx-background-color: -bs-color-background-popup;
@ -2216,9 +2239,8 @@ textfield */
.popup-bg-top {
-fx-font-size: 1.077em;
-fx-text-fill: -bs-rd-font-dark;
-fx-background-color: -bs-color-background-popup;
-fx-background-color: -bs-color-background-popup-overlay;
-fx-background-insets: 44;
-fx-effect: dropshadow(gaussian, -bs-text-color-transparent-dark, 44, 0, 0, 0);
-fx-background-radius: 0 0 15px 15px;
-fx-border-radius: 0 0 15px 15px;
}

View file

@ -853,22 +853,7 @@ public abstract class Overlay<T extends Overlay<T>> {
messageTextArea = new TextArea(truncatedMessage);
messageTextArea.setEditable(false);
messageTextArea.getStyleClass().add("text-area-popup");
messageTextArea.sceneProperty().addListener((o, oldScene, newScene) -> {
if (newScene != null) {
// avoid javafx css warning
CssTheme.loadSceneStyles(newScene, CssTheme.CSS_THEME_LIGHT, false);
messageTextArea.applyCss();
var text = messageTextArea.lookup(".text");
messageTextArea.prefHeightProperty().bind(Bindings.createDoubleBinding(() -> {
return messageTextArea.getFont().getSize() + text.getBoundsInLocal().getHeight();
}, text.boundsInLocalProperty()));
text.boundsInLocalProperty().addListener((observableBoundsAfter, boundsBefore, boundsAfter) -> {
Platform.runLater(() -> messageTextArea.requestLayout());
});
}
});
GUIUtil.adjustHeightAutomatically(messageTextArea);
messageTextArea.setWrapText(true);
Region messageRegion;

View file

@ -38,8 +38,9 @@ import haveno.core.xmr.wallet.BtcWalletService;
import haveno.desktop.components.HavenoTextArea;
import haveno.desktop.main.MainView;
import haveno.desktop.main.overlays.Overlay;
import haveno.desktop.util.CssTheme;
import haveno.desktop.util.DisplayUtils;
import haveno.desktop.util.GUIUtil;
import static haveno.desktop.util.DisplayUtils.getAccountWitnessDescription;
import static haveno.desktop.util.FormBuilder.add2ButtonsWithBox;
import static haveno.desktop.util.FormBuilder.addConfirmationLabelTextArea;
@ -48,12 +49,9 @@ import static haveno.desktop.util.FormBuilder.addLabelTxIdTextField;
import static haveno.desktop.util.FormBuilder.addTitledGroupBg;
import haveno.desktop.util.Layout;
import haveno.network.p2p.NodeAddress;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.value.ChangeListener;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
@ -127,7 +125,6 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
@Override
protected void createGridPane() {
super.createGridPane();
gridPane.setPadding(new Insets(35, 40, 30, 40));
gridPane.getStyleClass().add("grid-pane");
}
@ -229,22 +226,7 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
TextArea textArea = addConfirmationLabelTextArea(gridPane, ++rowIndex, Res.get("payment.shared.extraInfo.offer"), "", 0).second;
textArea.setText(offer.getCombinedExtraInfo().trim());
textArea.setMaxHeight(200);
textArea.sceneProperty().addListener((o, oldScene, newScene) -> {
if (newScene != null) {
// avoid javafx css warning
CssTheme.loadSceneStyles(newScene, CssTheme.CSS_THEME_LIGHT, false);
textArea.applyCss();
var text = textArea.lookup(".text");
textArea.prefHeightProperty().bind(Bindings.createDoubleBinding(() -> {
return textArea.getFont().getSize() + text.getBoundsInLocal().getHeight();
}, text.boundsInLocalProperty()));
text.boundsInLocalProperty().addListener((observableBoundsAfter, boundsBefore, boundsAfter) -> {
Platform.runLater(() -> textArea.requestLayout());
});
}
});
GUIUtil.adjustHeightAutomatically(textArea);
textArea.setEditable(false);
}

View file

@ -44,7 +44,8 @@
-bs-color-gray-aaa: #29292a;
-bs-color-gray-fafa: #0a0a0a;
-bs-color-gray-background: black;
-bs-color-background-popup: rgb(31, 31, 31);
-bs-color-background-popup: rgb(38, 38, 38);
-bs-color-background-popup-overlay: rgb(9, 9, 9);
-bs-color-background-form-field: rgb(18, 18, 18);
-bs-color-background-form-field-readonly: rgb(18, 18, 18);
-bs-color-border-form-field: rgb(65, 65, 65);

View file

@ -113,6 +113,7 @@
-bs-color-background-row-odd: derive(-bs-color-background-pane, -6%);
-bs-color-table-cell-dim: -bs-color-gray-ccc;
-bs-color-background-popup: white;
-bs-color-background-popup-overlay: white;
-bs-color-background-form-field: white;
-bs-text-color-dim1: black;
-bs-text-color-dim2: black;

View file

@ -58,6 +58,10 @@ public class CssTheme {
scene.getStylesheets().add(cssThemeFolder + "theme-dev.css");
}
public static int getCurrentTheme() {
return currentCSSTheme;
}
public static boolean isDarkTheme() {
return currentCSSTheme == CSS_THEME_DARK;
}

View file

@ -1188,8 +1188,7 @@ public class GUIUtil {
textArea.sceneProperty().addListener((o, oldScene, newScene) -> {
if (newScene != null) {
// avoid javafx css warning
boolean isLightTheme = newScene.getStylesheets().stream().anyMatch(url -> url.contains("theme-light.css"));
CssTheme.loadSceneStyles(newScene, isLightTheme ? CssTheme.CSS_THEME_LIGHT : CssTheme.CSS_THEME_DARK, false);
CssTheme.loadSceneStyles(newScene, CssTheme.getCurrentTheme(), false);
textArea.applyCss();
var text = textArea.lookup(".text");

View file

@ -37,7 +37,7 @@ import javafx.util.Duration;
@Singleton
public class Transitions {
public final static int DEFAULT_DURATION = 600;
public final static int DEFAULT_DURATION = 400;
private final Preferences preferences;
private Timeline removeEffectTimeLine;
@ -111,7 +111,7 @@ public class Transitions {
ColorAdjust darken = new ColorAdjust();
darken.setBrightness(0.0);
blur.setInput(darken);
KeyValue kv2 = new KeyValue(darken.brightnessProperty(), brightness);
KeyValue kv2 = new KeyValue(darken.brightnessProperty(), CssTheme.isDarkTheme() ? brightness * -0.2 : brightness);
KeyFrame kf2 = new KeyFrame(Duration.millis(getDuration(duration)), kv2);
timeline.getKeyFrames().addAll(kf1, kf2);
node.setEffect(blur);