瀏覽代碼

prefer .bss over .css

Sebastian Stenzel 3 年之前
父節點
當前提交
b656b591ed
共有 1 個文件被更改,包括 18 次插入4 次删除
  1. 18 4
      src/main/java/org/cryptomator/ui/fxapp/FxApplicationStyle.java

+ 18 - 4
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));
+		}
 	}
 }