Martchus / syncthingtray

Tray application and Dolphin/Plasma integration for Syncthing
https://martchus.github.io/syncthingtray/
Other
1.57k stars 43 forks source link

Theme does not switch to Dark on Windows 10 #111

Closed totobest closed 1 year ago

totobest commented 2 years ago

Relevant components

Environment and versions

Bug description Windows 10 configured with Dark theme. Installed syncthingtray for the first time. syncthing does not mach Windows theme. It is light (boooooo).

Steps to reproduce

  1. Have a Windows 10 with Dark theme
  2. Start syncthingtray
  3. Syncthingtray is light

Expected behavior Syncthing should be dark

Screenshots image

Additional context

Martchus commented 2 years ago

I usually use Windows to launch games on and don't care much about anything else. So I only took care of the theming support under GNU/Linux so far.

However, I would have expected that Qt is able to detect the system colors out of the box. I did not add any code which would enforce a certain color palette unless you use the setting under "Appearance" (shown in your screenshot)¹.

Windows added at some point a more "modern" UI which is quite separate from their traditional UI. Possibly you need to set the color palette for the traditional UI separately (e.g. in the traditional system settings) because that's very likely what Qt is picking up. If that works it would be useful to document the process.

Maybe it is also possible to use a style sheet (e.g. https://github.com/ColinDuquesnoy/QDarkStyleSheet or https://github.com/mumble-voip/mumble/blob/master/themes/Default/Dark.qss).

Note that in any case Syncthing Tray needs to be restarted to apply changes (and restarting means not just closing the last Window; you'll have to restart the whole process). Additionally, if you choose a dark color palette, you should also choose the dark icon theme and tick the checkbox for dark custom colors.


¹ This setting could also be a workaround (to set something dark on application-level) although I'm afraid the code for selecting a custom palette might currently be broken as it didn't survive the Qt 6 migration (switching to the Qt 5 version won't help).

Martchus commented 2 years ago

Looks like they've been removing the good old dialog to change colors: https://superuser.com/questions/949920/window-color-and-appearance-removed-in-win10

The new settings don't seem to be picked up by apps using the traditional GUI, not even Microsoft's own apps like the device manager and regedit are following the new color settings. Syncthing Tray simply falls into the same category of apps. It seems to work when setting high contrast colors but that's not looking nice.

So likely the css files are the best option here. I briefly tried the one from Mumble. It generally works but also still needs a lot of tweaking. I might also be able to fix the color palette option and also include some defaults there. Possibly there's also a way to deduce the default color palette from the "new" settings (despite Qt not being able to do this itself).

By the way, this is not a bug because it never worked before, at least not with the new theming which was introduced in some Windows version.

Martchus commented 2 years ago
Martchus commented 2 years ago

I've been fixing the palette setting and at least under GNU/Linux setting dark colors is actually quite simple with it. I've also been creating a Windows build (https://martchus.no-ip.biz/repo/arch/ownstuff-experimental/os/x86_64/mingw-w64-syncthingtray-1.1.11-1-any.pkg.tar.zst) but haven't had the chance to test it myself and also play around with the dark mode related settings Qt provides¹.

¹ If you want to test these settings yourself, the documentation is https://doc.qt.io/qt-6/qguiapplication.html#platform-specific-arguments but you'll have to set the environment variable QT_QPA_PLATFORM (instead of using the CLI argument -platform) for my applications.

Martchus commented 2 years ago

I've been documenting a workaround here: https://github.com/Martchus/syncthingtray#workaround-missing-support-for-windows-10-dark-mode

It requires a development build (https://martchus.no-ip.biz/repo/arch/ownstuff-experimental/os/x86_64/mingw-w64-syncthingtray-1.1.11-1-any.pkg.tar.zst) because the palette setting is broken in the latest release.

I'm aware that the workaround is quite involved. However, I'm not sure whether it is worth improving this within Syncthing Tray itself as it falls more into the responsibility of Qt and only Windows 10 is affected.

Martchus commented 2 years ago

By the way, after having the dark mode enabled in Windows 10 I must say that it is not really a good experience overall because many applications - also many provided by Windows itself - are also not affected by the dark mode setting similar to Syncthing Tray. However, these applications are still better than the ones which follow the dark mode setting but not entirely. In Firefox I even got gray text on black background in a dialog which was not readable at all.

totobest commented 2 years ago

Wow thank you for the extensive response.

That's not a really big issue for me. I'll wait for Qt to support 'modern' Windows theme.

Thank you again.

Martchus commented 2 years ago

I found it quite interesting to checkout the state of the dark mode under Windows in general and with Qt specifically.

To be clear: I think the best you'll get from Qt in terms of the end result is what you get today by following the workaround steps¹. Improvements in Qt would most likely only make it easier to configure and I suppose there would always be some additional work required from the application-side (even if only for the sake of compatibility).

¹ That's because the native "Windows Vista" style which is used by Qt under the hood is unlikely to be improved by Microsoft for dark theming. So Qt will always have to resort to using a custom style (like "Fusion" for Qt Widgets applications as my workaround suggests). And the "dark mode" really doesn't seem to provide a full color palette and is besides some "accent color" more that a flag. So Qt will still have to make up some custom color palette.


And I cannot help to advertise GNU/Linux desktop environments here: If you like a decent dark mode than KDE, GNOME and other DEs are much better when it comes to dark mode support than Windows and also Syncthing Tray will work out of the box there.

tomasz1986 commented 2 years ago

Looks like they've been removing the good old dialog to change colors: superuser.com/questions/949920/window-color-and-appearance-removed-in-win10

The dialogue is gone, but you can still edit the same colour values in the Registry manually. They do have effect in certain programs, especially the background colour, at least from my experience. High contrast themes also enforce those colour values globally, unless the software is either non-native and doesn't support high contrast in general, or decides to ignores it for some reason. The software I personally like is that which has an option to either follow high contrast or not. The worst software is that which enforces high contrast with no way back (vide MS Excel, which removes all background and font colouring in high contrast, making it basically impossible to use).

This seems to have all the information on classic and high contrast theming: https://docs.microsoft.com/windows/win32/controls/themesfileformat-overview.

I also saved these links, mainly because they include screenshots that specifically show which colours apply to what: https://web.archive.org/web/20190318051921/http://debbiesthemes.com/utilities/color_scheme.html https://neowin.net/forum/topic/624901-windows-colors-explained

On a side note, I have ported some classic themes to high contrast for Windows 8/10 (see https://github.com/tomasz1986/classic2000). Not directly related with the question at hand, but you may want to have a look at the Bugs & Issues section there. I use a high contrast theme myself, because I find the default theme options in Windows 8+ too limited, and actually difficult to use in terms of legibility, with almost no customisation and grey fonts everywhere. I used to always turn on the classic theme in Windows 7 and older, which had nice contrast and clear distinctive elements by default.

No requests on my part here, I just wanted to make a quick comment 😉.

Martchus commented 2 years ago

The dialogue is gone, but you can still edit the same colour values in the Registry manually. They do have effect in certain programs, especially the background colour, at least from my experience.

I've actually tested that. Do I need to do something after setting the values to apply them (except for restarting the applications)? But likely the applications I've tested just fall under the category that are not affected. I'm aware that the high contrast setting works and that it also works with Syncthing Tray (as noted in the workaround documentation). I just don't find them very pleasant to look at. The styling from Windows and also "traditional" applications like Syncthing Tray gets highly simplified. Your high contrast themes look at least nicer than what's shipped with Windows so if you like you can add a link in Syncthing Tray's README.

tomasz1986 commented 2 years ago

I've actually tested that. Do I need to do something after setting the values to apply them (except for restarting the applications)?

You probably need to reapply the theme, but I'm not sure how to do it programmatically. In case of high contrast themes, this happens when you change a theme in the Settings. Otherwise, I think you may need to at least log out and log in again to apply the new values from the Registry since they're user-specific.

I just don't find them very pleasant to look at. The styling from Windows and also "traditional" applications like Syncthing Tray gets highly simplified. Your high contrast themes look at least nicer than what's shipped with Windows so if you like you can add a link in Syncthing Tray's README.

Yeah, I fully agree. I began using them as the only alternative to apply custom window colours, especially in Windows 10. Thank you for the kind words regarding the themes 🙂. They're not exactly mine per se, but I did the work of spinning up a Windows 2000 VM and copying all the values directly from there.

Do you mean adding a tip under https://github.com/Martchus/syncthingtray#workaround-missing-support-for-windows-10-dark-mode? I guess they will fit in, although I must say these themes likely predate the whole dark mode thing 🤣. I assume at least the inverted ones can be used as such though.

Just a side note, but I myself usually stick to "Windows Standard (Warm)", which I further customise to my liking by changing the dark blue to a dark red kind of colour. I'm not a fan of dark themes in general, unless strictly at night in a very dark environment 😉.

Martchus commented 2 years ago

Note that Syncthing Tray can meanwhile detect itself when a dark color palette is used so the extra checkbox has been removed from the settings. Qt 6.4 will hopefully further simplify the currently necessary workaround (which has already been updated, see https://github.com/Martchus/syncthingtray#workaround-missing-support-for-windows-10-dark-mode).

Martchus commented 1 year ago

This has improved a lot with Qt 6.5.0 and recent changes I did. The README section linked in my previous comment has been updated accordingly. So with default settings one simply needs to select the Fusion style. There's also no need to restart Syncthing Tray anymore to apply. On Windows 11 the traditional styling doesn't look good anyways (because Qt needs still adaption to Windows 11 in that regard) so I decided to make Fusion the default style there. So on Windows 11 nothing has to be changed at all for the dark mode.

I think this is good enough so I'm closing the issue. I may consider making Fusion the default on all Windows versions (at least for the Qt 6 build). However, I personally prefer the traditional theming on Windows 10 (even though it only supports light mode).