mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-07 11:56:51 +00:00
Bug 1593390 - Use NSApp.effectiveAppearance to detect system dark mode. r=mac-reviewers,harry
Differential Revision: https://phabricator.services.mozilla.com/D110499
This commit is contained in:
parent
1ebb0b4ffa
commit
6d3a6fbf56
@ -639,10 +639,12 @@ bool nsLookAndFeel::AllowOverlayScrollbarsOverlap() { return (UseOverlayScrollba
|
||||
bool nsLookAndFeel::SystemWantsDarkTheme() {
|
||||
// This returns true if the macOS system appearance is set to dark mode on
|
||||
// 10.14+, false otherwise.
|
||||
if (!nsCocoaFeatures::OnMojaveOrLater()) {
|
||||
return false;
|
||||
if (@available(macOS 10.14, *)) {
|
||||
NSAppearanceName aquaOrDarkAqua = [NSApp.effectiveAppearance
|
||||
bestMatchFromAppearancesWithNames:@[ NSAppearanceNameAqua, @"NSAppearanceNameDarkAqua" ]];
|
||||
return [aquaOrDarkAqua isEqualToString:@"NSAppearanceNameDarkAqua"];
|
||||
}
|
||||
return !![[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
|
||||
return false;
|
||||
}
|
||||
|
||||
bool nsLookAndFeel::NativeGetFont(FontID aID, nsString& aFontName, gfxFontStyle& aFontStyle) {
|
||||
|
Loading…
Reference in New Issue
Block a user