From b656b591ed0b9e2da8ccd41a92721fed44e42a94 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Mon, 11 Apr 2022 12:32:07 +0200 Subject: [PATCH] prefer .bss over .css --- .../ui/fxapp/FxApplicationStyle.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/fxapp/FxApplicationStyle.java b/src/main/java/org/cryptomator/ui/fxapp/FxApplicationStyle.java index da2a4a800..dd81d200d 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 light_theme stylesheet"); + } else { + Application.setUserAgentStylesheet(stylesheet.toString()); + appearanceProvider.ifPresent(provider -> provider.adjustToTheme(Theme.DARK)); + } } }