Revert "Use enum instead of constants"

This commit is contained in:
Jack251970 2025-03-14 13:49:26 +08:00
parent 8484c2b87a
commit c17dcad896
5 changed files with 12 additions and 8 deletions

View file

@ -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 == ColorSchemes.System && isSystemDark) || (_settings.ColorScheme == ColorSchemes.Dark);
bool useDarkMode = Mode == "Dark" || (Mode == "Auto" && _settings.ColorScheme == "System" && isSystemDark) || (_settings.ColorScheme == "Dark");
Color selectedBG = useDarkMode ? DarkBG : LightBG;
ApplyPreviewBackground(selectedBG);

View file

@ -40,6 +40,10 @@ 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";

View file

@ -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 ColorSchemes ColorScheme { get; set; } = ColorSchemes.System;
public string ColorScheme { get; set; } = "System";
public bool ShowOpenResultHotkey { get; set; } = true;
public double WindowSize { get; set; } = 580;
public string PreviewHotkey { get; set; } = $"F1";

View file

@ -998,11 +998,11 @@ namespace Flow.Launcher
public void InitializeColorScheme()
{
if (_settings.ColorScheme == ColorSchemes.Light)
if (_settings.ColorScheme == Constant.Light)
{
ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Light;
}
else if (_settings.ColorScheme == ColorSchemes.Dark)
else if (_settings.ColorScheme == Constant.Dark)
{
ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Dark;
}

View file

@ -108,16 +108,16 @@ public partial class SettingsPaneThemeViewModel : BaseModel
public class ColorSchemeData : DropdownDataGeneric<ColorSchemes> { }
public List<ColorSchemeData> ColorSchemes { get; } = DropdownDataGeneric<ColorSchemes>.GetValues<ColorSchemeData>("ColorScheme");
public ColorSchemes ColorScheme
public string ColorScheme
{
get => Settings.ColorScheme;
set
{
ThemeManagerForColorSchemeSwitch.Current.ApplicationTheme = value switch
{
Infrastructure.UserSettings.ColorSchemes.Light => ApplicationTheme.Light,
Infrastructure.UserSettings.ColorSchemes.Dark => ApplicationTheme.Dark,
Infrastructure.UserSettings.ColorSchemes.System => null,
Constant.Light => ApplicationTheme.Light,
Constant.Dark => ApplicationTheme.Dark,
Constant.System => null,
_ => ThemeManagerForColorSchemeSwitch.Current.ApplicationTheme
};