mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
change theme on all app windows
This commit is contained in:
parent
6a1c3fa3da
commit
76820377ae
2 changed files with 24 additions and 3 deletions
|
@ -1014,10 +1014,16 @@ public class AppController implements Initializable {
|
||||||
Config.get().setTheme(selectedTheme);
|
Config.get().setTheme(selectedTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(selectedTheme == Theme.DARK) {
|
EventManager.get().post(new ThemeChangedEvent(selectedTheme));
|
||||||
tabs.getScene().getStylesheets().add(getClass().getResource("darktheme.css").toExternalForm());
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void themeChanged(ThemeChangedEvent event) {
|
||||||
|
String darkCss = getClass().getResource("darktheme.css").toExternalForm();
|
||||||
|
if(event.getTheme() == Theme.DARK && !tabs.getScene().getStylesheets().contains(darkCss)) {
|
||||||
|
tabs.getScene().getStylesheets().add(darkCss);
|
||||||
} else {
|
} else {
|
||||||
tabs.getScene().getStylesheets().remove(getClass().getResource("darktheme.css").toExternalForm());
|
tabs.getScene().getStylesheets().remove(darkCss);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.sparrowwallet.sparrow.event;
|
||||||
|
|
||||||
|
import com.sparrowwallet.sparrow.Theme;
|
||||||
|
|
||||||
|
public class ThemeChangedEvent {
|
||||||
|
private final Theme theme;
|
||||||
|
|
||||||
|
public ThemeChangedEvent(Theme theme) {
|
||||||
|
this.theme = theme;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Theme getTheme() {
|
||||||
|
return theme;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue