Files
ReminderOrganizer/Core/SystemPrefs.cs

27 lines
812 B
C#
Raw Normal View History

#nullable enable
using System.Globalization;
using Microsoft.Win32;
namespace ReminderOrganizer.Core
{
/// <summary>Defaults taken from Windows until the user picks something in the app.</summary>
public static class SystemPrefs
{
public static string Language(CultureInfo? culture = null) =>
(culture ?? CultureInfo.CurrentUICulture).TwoLetterISOLanguageName == "de" ? "de" : "en";
public static bool IsDarkMode()
{
try
{
using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
return key?.GetValue("AppsUseLightTheme") is int v && v == 0;
}
catch
{
return true;
}
}
}
}