Window vibrant dark mode for macOS (possible JUCE enhancement)


#1

I like my macOS apps to use NSAppearanceNameVibrantDark mode so I modified my local JUCE branch. For the most part in a JUCE app this yields a black title bar. Not sure if others do this enough to warrant merging it into the JUCE code.
image

juce_ComponentPeer.h @ line 75

        windowDarkMode              = (1 << 11),   /**< Dark Mode for macOS */

juce_mac_NSViewComponentPeer.cpp @ line 144

#if defined (MAC_OS_X_VERSION_10_10) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10)
if (windowStyleFlags & windowDarkMode)
{
    window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameVibrantDark];
}
#endif

The to implement override getDesktopWindowStyleFlags() in your app

int getDesktopWindowStyleFlags() const override
{
    return DocumentWindow::getDesktopWindowStyleFlags() | ComponentPeer::windowDarkMode;
}


#2

+1, it’d be cool to use this with juce::Desktop::isOSXDarkModeActive()


#3

Another +1

You should add this as a PR on Github