From 52c76fcf110652a0c4476987a31cbfe5d81e015f Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2019 13:28:04 -0700 Subject: [PATCH] fix: make isDarkMode correctly detect dark mode in the auto setting on catalina (#18959) --- atom/browser/api/atom_api_system_preferences_mac.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/atom/browser/api/atom_api_system_preferences_mac.mm b/atom/browser/api/atom_api_system_preferences_mac.mm index 70e0287f6c324..75b24c2af71e6 100644 --- a/atom/browser/api/atom_api_system_preferences_mac.mm +++ b/atom/browser/api/atom_api_system_preferences_mac.mm @@ -439,6 +439,10 @@ AVMediaType ParseMediaType(const std::string& media_type) { } bool SystemPreferences::IsDarkMode() { + if (@available(macOS 10.14, *)) { + return [[NSApplication sharedApplication].effectiveAppearance.name + isEqualToString:NSAppearanceNameDarkAqua]; + } NSString* mode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"]; return [mode isEqualToString:@"Dark"];