- Target: .net 9.0 MacOS 15.2
public static class ThemeService
{
public static void InitializeThemeListener()
{
var nativeTheme = Electron.NativeTheme;
nativeTheme.Updated += async () =>
{
var isDarkMode = await nativeTheme.ShouldUseDarkColorsAsync();
Console.WriteLine(isDarkMode
? $"OS theme changed. Dark Mode: {isDarkMode}"
: $"OS theme changed. Light Mode: {isDarkMode}");
};
}
}
The listener is triggered appropriately when I change the default theme on macOS Sequoia.
Am I misunderstanding how to check for OS initiated theme changes?
The listener is triggered appropriately when I change the default theme on macOS Sequoia.
Am I misunderstanding how to check for OS initiated theme changes?