Browse Source

fix: make isDarkMode correctly detect dark mode in the auto setting on catalina (#18958)

trop[bot] 5 years ago
parent
commit
74b06ab677
1 changed files with 4 additions and 0 deletions
  1. 4 0
      atom/browser/api/atom_api_system_preferences_mac.mm

+ 4 - 0
atom/browser/api/atom_api_system_preferences_mac.mm

@@ -625,6 +625,10 @@ void SystemPreferences::RemoveUserDefault(const std::string& name) {
 }
 
 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"];