diff --git a/DiscordChatExporter.Gui/Services/SettingsService.cs b/DiscordChatExporter.Gui/Services/SettingsService.cs index 9ee9886..cca7042 100644 --- a/DiscordChatExporter.Gui/Services/SettingsService.cs +++ b/DiscordChatExporter.Gui/Services/SettingsService.cs @@ -1,13 +1,14 @@ using DiscordChatExporter.Core.Exporting; +using Microsoft.Win32; using Tyrrrz.Settings; namespace DiscordChatExporter.Gui.Services; -public class SettingsService : SettingsManager +public partial class SettingsService : SettingsManager { public bool IsAutoUpdateEnabled { get; set; } = true; - public bool IsDarkModeEnabled { get; set; } + public bool IsDarkModeEnabled { get; set; } = IsDarkModeEnabledByDefault(); public bool IsTokenPersisted { get; set; } = true; @@ -35,4 +36,21 @@ public class SettingsService : SettingsManager } public bool ShouldSerializeLastToken() => IsTokenPersisted; +} + +public partial class SettingsService +{ + private static bool IsDarkModeEnabledByDefault() + { + try + { + return Registry.CurrentUser.OpenSubKey( + "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", false + )?.GetValue("AppsUseLightTheme") is 0; + } + catch + { + return false; + } + } } \ No newline at end of file