mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Load different CSS file depending on dark mode setting
This commit is contained in:
parent
4eb85b955e
commit
e2b47c8a37
@ -176,6 +176,7 @@ public class BisqApp extends Application implements UncaughtExceptionHandler {
|
||||
log.warn("Scene not available yet, we create a new scene. The bug might be caused by an exception in a constructor or by a circular dependency in Guice. throwable=" + throwable.toString());
|
||||
scene = new Scene(new StackPane(), 1000, 650);
|
||||
scene.getStylesheets().setAll(
|
||||
"/bisq/desktop/theme-light.css",
|
||||
"/bisq/desktop/bisq.css",
|
||||
"/bisq/desktop/images.css");
|
||||
stage.setScene(scene);
|
||||
@ -227,14 +228,28 @@ public class BisqApp extends Application implements UncaughtExceptionHandler {
|
||||
maxWindowBounds.height < INITIAL_WINDOW_HEIGHT ?
|
||||
(maxWindowBounds.height < MIN_WINDOW_HEIGHT ? MIN_WINDOW_HEIGHT : maxWindowBounds.height) :
|
||||
INITIAL_WINDOW_HEIGHT);
|
||||
scene.getStylesheets().setAll(
|
||||
"/bisq/desktop/bisq.css",
|
||||
"/bisq/desktop/images.css",
|
||||
"/bisq/desktop/CandleStickChart.css");
|
||||
|
||||
addSceneKeyEventHandler(scene, injector);
|
||||
|
||||
loadSceneStyles(scene, injector);
|
||||
injector.getInstance(Preferences.class).getCssThemeProperty().addListener((ov) -> {
|
||||
loadSceneStyles(scene, injector);
|
||||
});
|
||||
return scene;
|
||||
}
|
||||
|
||||
private void loadSceneStyles(Scene scene, Injector injector) {
|
||||
Boolean useDarkMode = (injector.getInstance(Preferences.class).getCssTheme() == 1);
|
||||
String colorSheet = "/bisq/desktop/theme-light.css";
|
||||
if (useDarkMode)
|
||||
colorSheet = "/bisq/desktop/theme-dark.css";
|
||||
scene.getStylesheets().setAll(
|
||||
colorSheet,
|
||||
"/bisq/desktop/bisq.css",
|
||||
"/bisq/desktop/images.css",
|
||||
"/bisq/desktop/CandleStickChart.css");
|
||||
}
|
||||
|
||||
private void setupStage(Scene scene) {
|
||||
// configure the system tray
|
||||
SystemTray.create(stage, shutDownHandler);
|
||||
|
0
desktop/src/main/java/bisq/desktop/theme-dark.css
Normal file
0
desktop/src/main/java/bisq/desktop/theme-dark.css
Normal file
0
desktop/src/main/java/bisq/desktop/theme-light.css
Normal file
0
desktop/src/main/java/bisq/desktop/theme-light.css
Normal file
Loading…
Reference in New Issue
Block a user