The qt_mac_applicationIsInDarkMode
function
0bool qt_mac_applicationIsInDarkMode()
1{
2#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
3 if (__builtin_available(macOS 10.14, *)) {
4 auto appearance = [NSApp.effectiveAppearance bestMatchFromAppearancesWithNames:
5 @[ NSAppearanceNameAqua, NSAppearanceNameDarkAqua ]];
6 return [appearance isEqualToString:NSAppearanceNameDarkAqua];
7 }
8#endif
9 return false;
10}
behavior depends on the compiler that was used for static build.
It returns true
or false
depending on OS appearance setting on old compilers:
- apple clang 10.0.1 on macOS Mojave 10.14.6 (18G8022)
- llvm clang 8.0.0 used in depends
It always returns false
on newer compilers:
- apple clang 12.0.0 on macOS Catalina 10.15.7 (19H524) and Big Sur 11.2.3 (20D91)
- llvm clang 10.0.1 in depends, see #19817 (comment)