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

This commit is contained in:
Samuel Attard 2019-06-24 10:17:38 -07:00 committed by GitHub
parent 1cd7c21f38
commit 5686a0713e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -628,6 +628,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"];