8000 fix: use effectiveAppearance to check dark mode on mojave and above by MarshallOfSound · Pull Request #18666 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: use effectiveAppearance to check dark mode on mojave and above #18666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
E72C
Diff view
6 changes: 6 additions & 0 deletions atom/browser/ui/tray_icon_cocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -146,6 +148,10 @@ - (void)drawRect:(NSRect)dirtyRect {
}

- (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"];
Expand Down
0