Make the titlebar dark when dark mode is enabled (Windows)
Summary
A dark titlebar when dark mode is enabled.
Examples

Context
The white titlebar greats a visual disruption and also hurts the eye if dark mode is enabled in other places such as in Windows shell, browser etc.
Possible implementation
There is an API (undocumented) introduced in W10 v1809 that changes the titlebar color for Win32 apps: https://github.com/ysc3839/win32-darkmode/blob/cc26549b65b25d6f3168a80238792545bd401271/win32-darkmode/DarkMode.h#L107
This is a known issue and we haven't really found a way to make it work with the Win32 API and Msys2. I'll check if the proposed solution works, but so far all attempts have failed or would have required us to draw our own title bars entirely.
Could be possible when we go to visual studio
UWP/XAML apps have all the APIs for this kind of stuff. Win32 is more restricted, but with access to the full WinRT API it could be easier.
I just saw in a Reddit thread that the dark titlebar support is publicly available in the Windows 11 SDK and that the documentation will be updated soon: https://www.reddit.com/r/Windows11/comments/qw7o69/comment/hl1tibg/
I tried out the APIs, but something doesn't work. No matter what I do, the titlebar stays white. Maybe Qt is interfering somewhere.
@phoerious might be able to give this another go with the WinRT API's.
I was able to do change the title bar colour with the Win32 API, but only to pure black, which looked even more out of place than leaving it white. Does WinRT allow custom colours or do we have to render CSDs?
Could be buried somewhere in here: https://docs.microsoft.com/en-us/uwp/api/windows.ui?view=winrt-22000
But this might also require a CoreWindow to be created... which we cannot do with Qt.
Qt 5.15, at least, might support it via a darkmode=1 argument to the Windows platform plugin (QGuiApplication - Platform-Specific Arguments), you can launch KeePassXC with -platform windows:darkmode=1 to enable it. But it would be nice to enable it by default. Perhaps via qt.conf? (It's probably not enabled by default since Qt Widgets doesn't come with a native dark mode style. It is something KeePassXC implemented)
I'm not sure whether Qt 6 has added native support for this or enabled this by default for Qt Widgets since Qt 5.15. – https://github.com/keepassxreboot/keepassxc/issues/7782#issue-1191039285
From the duplicate issue I opened. (Damn search...)
This is how this can be implemented, by just adding a key to qt.conf:
[Platforms]
WindowsArguments = darkmode=1
(I only tested using the CLI approach for setting this)
Just commenting to act as an upvote and track the issue.
We haven't done anything in this regard, because the Win32 dark mode is pretty useless. The only option Windows provides via the old API is a pitch black title bar.
Gotta love Windows.....
But KeePassXC has added it's own dark mode. Just adding what I listed in https://github.com/keepassxreboot/keepassxc/issues/6775#issuecomment-1087320697 will also make the title bar dark for completion.
The dark Windows title bar doesn't match our dark theme in the slightest.
Not surprising, but isn't this still better than a light one when the rest of the app is dark...?
I would say no. It looks quite out of place, actually.
I will be happy to have a dark mode that is not optimal, better than burn-in on my oled from the bright white titlebar.
Without this qt.conf the titlebar is white when you do not use your accent color for titlebars. This setting is possible in Windows 11 (don't remember windows 10 at this point). Adding the qt.conf settings above has no affect if the below setting is activated, so I think adding the qt.conf is a win win.

Without this qt.conf the titlebar is white when you do not use your accent color for titlebars. This setting is possible in Windows 11 (don't remember windows 10 at this point). Adding the qt.conf settings above has no affect if the below setting is activated, so I think adding the qt.conf is a win win.
Just because you didn't show the Win10 menu version, here it is for anyone else:
