diff --git a/pom.xml b/pom.xml index 90aee2668..b682f693d 100644 --- a/pom.xml +++ b/pom.xml @@ -298,6 +298,41 @@ + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + + + compile-light-theme + compile + + java + + + javafx.graphics/com.sun.javafx.css.parser.Css2Bin + + ${project.basedir}/src/main/resources/css/light_theme.css + ${project.build.outputDirectory}/css/light_theme.bss + + + + + compile-dark-theme + compile + + java + + + javafx.graphics/com.sun.javafx.css.parser.Css2Bin + + ${project.basedir}/src/main/resources/css/dark_theme.css + ${project.build.outputDirectory}/css/dark_theme.bss + + + + + org.apache.maven.plugins maven-jar-plugin diff --git a/src/main/java/org/cryptomator/ui/fxapp/FxApplicationStyle.java b/src/main/java/org/cryptomator/ui/fxapp/FxApplicationStyle.java index da2a4a800..711da7948 100644 --- a/src/main/java/org/cryptomator/ui/fxapp/FxApplicationStyle.java +++ b/src/main/java/org/cryptomator/ui/fxapp/FxApplicationStyle.java @@ -83,12 +83,26 @@ public class FxApplicationStyle { } private void applyLightTheme() { - Application.setUserAgentStylesheet(getClass().getResource("/css/light_theme.css").toString()); - appearanceProvider.ifPresent(provider -> provider.adjustToTheme(Theme.LIGHT)); + var stylesheet = Optional // + .ofNullable(getClass().getResource("/css/light_theme.bss")) // + .orElse(getClass().getResource("/css/light_theme.css")); + if (stylesheet == null) { + LOG.warn("Failed to load light_theme stylesheet"); + } else { + Application.setUserAgentStylesheet(stylesheet.toString()); + appearanceProvider.ifPresent(provider -> provider.adjustToTheme(Theme.LIGHT)); + } } private void applyDarkTheme() { - Application.setUserAgentStylesheet(getClass().getResource("/css/dark_theme.css").toString()); - appearanceProvider.ifPresent(provider -> provider.adjustToTheme(Theme.DARK)); + var stylesheet = Optional // + .ofNullable(getClass().getResource("/css/dark_theme.bss")) // + .orElse(getClass().getResource("/css/dark_theme.css")); + if (stylesheet == null) { + LOG.warn("Failed to load dark_theme stylesheet"); + } else { + Application.setUserAgentStylesheet(stylesheet.toString()); + appearanceProvider.ifPresent(provider -> provider.adjustToTheme(Theme.DARK)); + } } }