diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index da3f9f708..5edf8584c 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -457,7 +457,7 @@ namespace Flow.Launcher.Core.Resource // ✅ 설정의 ColorScheme을 우선 사용 int themeValue = (int)Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", 1); bool isSystemDark = themeValue == 0; - bool useDarkMode = Mode == "Dark" || (Mode == "Auto" && _settings.ColorScheme == "System" && isSystemDark) || (_settings.ColorScheme == "Dark"); + bool useDarkMode = Mode == "Dark" || (Mode == "Auto" && _settings.ColorScheme == ColorSchemes.System && isSystemDark) || (_settings.ColorScheme == ColorSchemes.Dark); Color selectedBG = useDarkMode ? DarkBG : LightBG; ApplyPreviewBackground(selectedBG); diff --git a/Flow.Launcher.Infrastructure/Constant.cs b/Flow.Launcher.Infrastructure/Constant.cs index c86ed4324..8a73b8f05 100644 --- a/Flow.Launcher.Infrastructure/Constant.cs +++ b/Flow.Launcher.Infrastructure/Constant.cs @@ -40,10 +40,6 @@ namespace Flow.Launcher.Infrastructure public const string DefaultTheme = "Win11Light"; - public const string Light = "Light"; - public const string Dark = "Dark"; - public const string System = "System"; - public const string Themes = "Themes"; public const string Settings = "Settings"; public const string Logs = "Logs"; diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 8277e8e0b..1a46282bc 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -37,7 +37,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings private string _theme = Constant.DefaultTheme; public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}"; public string OpenResultModifiers { get; set; } = KeyConstant.Alt; - public string ColorScheme { get; set; } = "System"; + public ColorSchemes ColorScheme { get; set; } = ColorSchemes.System; public bool ShowOpenResultHotkey { get; set; } = true; public double WindowSize { get; set; } = 580; public string PreviewHotkey { get; set; } = $"F1"; diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 9f8063a87..5194e02d0 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -998,11 +998,11 @@ namespace Flow.Launcher public void InitializeColorScheme() { - if (_settings.ColorScheme == Constant.Light) + if (_settings.ColorScheme == ColorSchemes.Light) { ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Light; } - else if (_settings.ColorScheme == Constant.Dark) + else if (_settings.ColorScheme == ColorSchemes.Dark) { ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Dark; } diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs index 77b9ab3cf..516e6ca95 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs @@ -15,8 +15,6 @@ using Flow.Launcher.ViewModel; using ModernWpf; using ThemeManager = Flow.Launcher.Core.Resource.ThemeManager; using ThemeManagerForColorSchemeSwitch = ModernWpf.ThemeManager; -using static Flow.Launcher.Core.Resource.Theme; -using System.Windows.Interop; namespace Flow.Launcher.SettingPages.ViewModels; @@ -38,8 +36,11 @@ public partial class SettingsPaneThemeViewModel : BaseModel ThemeManager.Instance.ChangeTheme(value.FileNameWithoutExtension); if (ThemeManager.Instance.BlurEnabled && Settings.UseDropShadowEffect == false) + { DropShadowEffect = true; OnPropertyChanged(nameof(IsDropShadowEnabled)); + } + ThemeManager.Instance.RefreshFrame(); //ThemeManager.Instance.SetBlurForWindow(); } @@ -107,6 +108,16 @@ public partial class SettingsPaneThemeViewModel : BaseModel public class ColorSchemeData : DropdownDataGeneric { } public List ColorSchemes { get; } = DropdownDataGeneric.GetValues("ColorScheme"); + public ColorSchemes ColorScheme + { + get => Settings.ColorScheme; + set + { + UpdateColorScheme(); + + Settings.ColorScheme = value; + } + } public List TimeFormatList { get; } = new() { @@ -463,13 +474,13 @@ public partial class SettingsPaneThemeViewModel : BaseModel App.API.OpenDirectory(Path.Combine(DataLocation.DataDirectory(), Constant.Themes)); } - public void UpdateColorScheme() + private void UpdateColorScheme() { ThemeManagerForColorSchemeSwitch.Current.ApplicationTheme = Settings.ColorScheme switch { - Constant.Light => ApplicationTheme.Light, - Constant.Dark => ApplicationTheme.Dark, - Constant.System => null, + Infrastructure.UserSettings.ColorSchemes.Light => ApplicationTheme.Light, + Infrastructure.UserSettings.ColorSchemes.Dark => ApplicationTheme.Dark, + Infrastructure.UserSettings.ColorSchemes.System => null, _ => ThemeManagerForColorSchemeSwitch.Current.ApplicationTheme }; ThemeManager.Instance.RefreshFrame(); diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml index ec068cb5c..d45556e1d 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -688,9 +688,8 @@ DisplayMemberPath="Display" FontSize="14" ItemsSource="{Binding ColorSchemes}" - SelectedValue="{Binding Settings.ColorScheme}" - SelectedValuePath="Value" - SelectionChanged="Selector_OnSelectionChanged" /> + SelectedValue="{Binding ColorScheme, Mode=TwoWay}" + SelectedValuePath="Value" /> diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml.cs b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml.cs index 7f32728c2..18d3a31a2 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml.cs +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml.cs @@ -1,7 +1,4 @@ using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; using System.Windows.Navigation; using Flow.Launcher.SettingPages.ViewModels; using Page = ModernWpf.Controls.Page; @@ -25,9 +22,4 @@ public partial class SettingsPaneTheme : Page base.OnNavigatedTo(e); } - - private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - _viewModel.UpdateColorScheme(); - } }