Window vibrant dark mode for macOS (possible JUCE enhancement)

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;
}

5 Likes

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

Another +1

You should add this as a PR on Github

1 Like

Another +1 for having this in JUCE. I just created a little helper to do this:

Is there an equivalent on Windows? E.g. the Skype app has a dark title bar, so it must be possible, just not sure if its accessible via win32 APIs (I assume not…)