diff --git a/DiscordChatExporter.Gui/App.axaml.cs b/DiscordChatExporter.Gui/App.axaml.cs index 05eb9c05..a62e75b9 100644 --- a/DiscordChatExporter.Gui/App.axaml.cs +++ b/DiscordChatExporter.Gui/App.axaml.cs @@ -59,13 +59,9 @@ public class App : Application, IDisposable { RequestedThemeVariant = _settingsService.Theme switch { - ThemeVariant.System => Avalonia.Styling.ThemeVariant.Default, ThemeVariant.Light => Avalonia.Styling.ThemeVariant.Light, ThemeVariant.Dark => Avalonia.Styling.ThemeVariant.Dark, - _ - => throw new InvalidOperationException( - $"Unknown theme '{_settingsService.Theme}'." - ) + _ => Avalonia.Styling.ThemeVariant.Default }; InitializeTheme(); @@ -91,17 +87,13 @@ public class App : Application, IDisposable { "Light" => PlatformThemeVariant.Light, "Dark" => PlatformThemeVariant.Dark, - _ => PlatformSettings?.GetColorValues().ThemeVariant + _ => PlatformSettings?.GetColorValues().ThemeVariant ?? PlatformThemeVariant.Light }; - this.LocateMaterialTheme().CurrentTheme = actualTheme switch - { - PlatformThemeVariant.Light - => Theme.Create(Theme.Light, Color.Parse("#343838"), Color.Parse("#F9A825")), - PlatformThemeVariant.Dark - => Theme.Create(Theme.Dark, Color.Parse("#E8E8E8"), Color.Parse("#F9A825")), - _ => throw new InvalidOperationException($"Unknown theme '{actualTheme}'.") - }; + this.LocateMaterialTheme().CurrentTheme = + actualTheme == PlatformThemeVariant.Light + ? Theme.Create(Theme.Light, Color.Parse("#343838"), Color.Parse("#F9A825")) + : Theme.Create(Theme.Dark, Color.Parse("#E8E8E8"), Color.Parse("#F9A825")); } public override void OnFrameworkInitializationCompleted()