From 72cc85aedbeba2520b2f7f390622c70d28a17ef6 Mon Sep 17 00:00:00 2001 From: weisj <31143295+weisJ@users.noreply.github.com> Date: Wed, 26 May 2021 23:05:32 +0200 Subject: [PATCH] Add method to determine whether a SettingsConfigurations behave the same at the time of calling the method. --- .../darklaf/settings/SettingsConfiguration.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/src/main/java/com/github/weisj/darklaf/settings/SettingsConfiguration.java b/core/src/main/java/com/github/weisj/darklaf/settings/SettingsConfiguration.java index 39c27cb2..c819e987 100644 --- a/core/src/main/java/com/github/weisj/darklaf/settings/SettingsConfiguration.java +++ b/core/src/main/java/com/github/weisj/darklaf/settings/SettingsConfiguration.java @@ -22,6 +22,7 @@ package com.github.weisj.darklaf.settings; import java.io.Serializable; +import java.util.Objects; import com.github.weisj.darklaf.LafManager; import com.github.weisj.darklaf.platform.ThemePreferencesHandler; @@ -277,4 +278,15 @@ public class SettingsConfiguration implements Serializable { + ", isSelectionColorFollowsSystem=" + isSelectionColorFollowsSystem + ", accentColorRule=" + accentColorRule + ", fontSizeRule=" + fontSizeRule + ", theme=" + theme + '}'; } + + public boolean isResultingAppearanceEqualTo(final SettingsConfiguration other) { + return other.isSystemPreferencesEnabled() == isSystemPreferencesEnabled() && + other.isThemeFollowsSystem() == isThemeFollowsSystem() && + other.isAccentColorFollowsSystem() == isAccentColorFollowsSystem() && + other.isSelectionColorFollowsSystem() == isSelectionColorFollowsSystem() && + other.isFontSizeFollowsSystem() == isFontSizeFollowsSystem() && + Objects.equals(other.getAccentColorRule(), getAccentColorRule()) && + Objects.equals(other.getFontSizeRule(), getFontSizeRule()) && + Objects.equals(Theme.baseThemeOf(other.getTheme()), Theme.baseThemeOf(getTheme())); + } }