Forum > Win32/64

Windows 10 - How to use or apply the "theme" or "color scheme"?

(1/2) > >>

I'm looking for a way to apply the Windows "theme" or "color scheme" under Windows 10, to my application, as set with the "Personalize" option (right click desktop).
So if the user sets the colors to "dark" then I'd ideally would like to see my application to reflect that as well.
I'm not a dark theme user myself, but I do believe that when a user changes the appearance of Windows to their liking, that my application should at least try to match that style and color scheme.

I've read about the project options (use manifest), which applies the theme (I think) but not the colors of the personalized options.
Trying to find more info on the manifest unfortunately did not clarify this for me.

I also read that the modern (Windows 10) colors uses a different mechanism (UWP vs Win32?), and I've noticed that GetSysColor (winuser.h) does NOT provide these colors and instead returns the fixed and unchanged default colors (probably used by LCL as well?).

The Windows registry seems to hold a flag that indicates if the user uses dark or light mode - but relying on a registry value (versus a proper API call) doesn't seem right to me and feels a little like a hack. Trying it anyway did show me that the values stored there are not the best to rely on.

I did read about JwaUxTheme, but it seems this relies on UXTheme from Windows XP, which doesn't include the colors either. (please correct me if I'm wrong)

Is there a way. or a future plan to implement this in LCL, without switching to a different (custom drawn) widgetset, to accomplish this?
It seems even Xojo supports this (I'm not using Xojo, just bumped into it when googling for a solution).

Note: I'm not a Windows expert, so any help or insight would be appreciated.

I would be interested in this solution, too. I have successfully converted my apps to support the dark mode on macOS, so it should be easy to do this on Windows, too. It would be necessary to know if the the dark theme is activated, however.

posted this on a different topic a minute ago,,48179.msg354269.html#msg354269

but I haven't tried the steps yet (or if this is the most up to date process). Would be nice to know if someone else has already figured this out

Please find at,42810.msg354372/topicseen.html#new a possible cross-platform solution that works on Windows and macOS as well.

Thanks for the Tip!  :)
Your function works great - thanks!

Just one "but" - well actually maybe more than one ...
The application still does not get notified when the "theme" changes back and forth between light and dark.
If we test DarkTheme during the onPaint event, then we can detect it easily with your function. However when changing the theme nothing seems to notify the application that the theme has been changed (not a flaw in you function of course). So the user will need to "touch" the form, or move over it to trigger an OnPaint event.
Additionally, and I think the is probably related to Win32 vs UWP, none of the LCL controls adapt to the new theme colors (like we see in Cocoa).


[0] Message Index

[#] Next page

Go to full version