fix: use effectiveAppearance to check dark mode on mojave and above (#18666)
* fix: use effectiveAppearance to check dark mode on mojave and above * chore: add forward declarations for dark appearance
This commit is contained in:
parent
bb19142389
commit
ad54d38678
1 changed files with 6 additions and 0 deletions
|
@ -7,8 +7,10 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "atom/browser/mac/atom_application.h"
|
||||
#include "atom/browser/ui/cocoa/NSString+ANSI.h"
|
||||
#include "atom/browser/ui/cocoa/atom_menu_controller.h"
|
||||
#include "base/mac/sdk_forward_declarations.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/events/cocoa/cocoa_event_utils.h"
|
||||
|
@ -146,6 +148,10 @@ const CGFloat kVerticalTitleMargin = 2;
|
|||
}
|
||||
|
||||
- (BOOL)isDarkMode {
|
||||
if (@available(macOS 10.14, *)) {
|
||||
return [[NSApplication sharedApplication].effectiveAppearance.name
|
||||
isEqualToString:NSAppearanceNameDarkAqua];
|
||||
}
|
||||
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSString* mode = [defaults stringForKey:@"AppleInterfaceStyle"];
|
||||
return mode && [mode isEqualToString:@"Dark"];
|
||||
|
|
Loading…
Reference in a new issue