From fa03f320e9b79c473f6ffed54ac716ea2dde2fe3 Mon Sep 17 00:00:00 2001 From: crschnick Date: Sat, 7 Mar 2026 12:43:18 +0000 Subject: [PATCH] Rework theme transition --- .../main/java/io/xpipe/app/core/AppTheme.java | 37 +------------------ 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/core/AppTheme.java b/app/src/main/java/io/xpipe/app/core/AppTheme.java index 12cf48cf9..a39e858bb 100644 --- a/app/src/main/java/io/xpipe/app/core/AppTheme.java +++ b/app/src/main/java/io/xpipe/app/core/AppTheme.java @@ -251,41 +251,8 @@ public class AppTheme { TrackEvent.debug("Setting theme " + newTheme.getId() + " for scene"); - // Don't animate transition in performance mode - if (AppPrefs.get() == null || AppPrefs.get().performanceMode().get()) { - newTheme.apply(); - return; - } - - var stage = window.getStage(); - var scene = stage.getScene(); - Pane root = (Pane) scene.getRoot(); - Image snapshot = null; - try { - scene.snapshot(null); - } catch (Exception ex) { - // This can fail if there is no window / screen I guess? - ErrorEventFactory.fromThrowable(ex).expected().omit().handle(); - return; - } - ImageView imageView = new ImageView(snapshot); - root.getChildren().add(imageView); + // Don't animate anything for performance reasons newTheme.apply(); - - Platform.runLater(() -> { - // Animate! - var transition = new Timeline( - new KeyFrame( - Duration.millis(0), - new KeyValue(imageView.opacityProperty(), 1, Interpolator.EASE_OUT)), - new KeyFrame( - Duration.millis(600), - new KeyValue(imageView.opacityProperty(), 0, Interpolator.EASE_OUT))); - transition.setOnFinished(e -> { - root.getChildren().remove(imageView); - }); - transition.play(); - }); }); } @@ -368,7 +335,7 @@ public class AppTheme { "dark", "primer", new PrimerDark(), - () -> AppFontSizes.forOs(AppFontSizes.BASE_11, AppFontSizes.BASE_10_5, AppFontSizes.BASE_11), + () -> AppFontSizes.forOs(AppFontSizes.BASE_10_5, AppFontSizes.BASE_10_5, AppFontSizes.BASE_11), Color.web("#0d1117"), Color.web("#c9d1d9"), () -> ColorHelper.withOpacity(