Support to Dark Mode on Windows 10.

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
User avatar
DebugBSD
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Apr 30, 2020 6:15 am
Location: Madrid, Spain

Support to Dark Mode on Windows 10.

Post by DebugBSD »

Hi, good morning.

First of all, I'm so sorry if this is not the correct place to post this message, so feel free to change it wherever it should be or tell me where I should post in. I haven't seen any better place than this so, that's why I posted here.

The point is about how to enable Dark Mode on Windows 10 with wxWidgets. I've seen other posts in this forum about dark mode on Windows 10 and it seems that it's not supported right now, although maybe on the git repository. Just for Mac OS X. Into my windows I have changed to Dark Mode (Right Click with the mouse on the Desktop -> Personalization -> Colors) (you can see an example in the next image) and I've tested wxWidgets but there was not good luck. So, that's my question. Is about the status of Dark Mode on Windows with wxWidgets

I tried the current version which can be downloaded from the web page (which is 3.1.3) and I tried the version from the Git Repository (branch Master).
For the version of GitHub I followed the instructions to build it and I had some problems when I did git clone as requested by:

https://github.com/wxWidgets/wxWidgets/ ... DME-GIT.md

I had some problems about broken submodules. But finally I had to download every external dependency myself (for each breach) and I could built wxWidgets with all of the samples and demos. But there wasn't good luck too.

Maybe some fo you could help me with this problem.

Thank you so much anyway.
Attachments
Captura.png
Captura.png (12.96 KiB) Viewed 14984 times
catalin
Moderator
Moderator
Posts: 1618
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: Support to Dark Mode on Windows 10.

Post by catalin »

Hi and welcome,

Maybe "Platform Related Issues" would have been a better category, but don't worry about it, any moderator can move it at any time.

I don't know much about dark mode in Windows, but as far as I remember, it does not apply in any way to win32 API, which was used to implement wxW MSW port. Such settings can only have effect on UWP/WinRT/WinUI apps. Currently there is no easy way to use these new features from win32, but MS did advertise that the upcoming WinUI 3.0 will include easy access to new features from win32 apps (and even without using XAML). Until then though, I'm afraid you're out of luck.

p.s. when building from git sources: https://www.wxwidgets.org/develop/code-repository/
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: Support to Dark Mode on Windows 10.

Post by PB »

I will just add the link to the "the master thread" for Dark Mode (lack of) support on Windows
viewtopic.php?f=23&t=45869

I have never even heard of WinUI 3 but looking at it, it seems that adding its support to wxWidgets would be a major undertaking (i.e., a whole new toolkit) and maybe locked to using MSVC as the compiler.

And am I missing something or is WinUI 3 really based on Chromium? EDIT: No, fortunately it seems it is not.
User avatar
DebugBSD
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Apr 30, 2020 6:15 am
Location: Madrid, Spain

Re: Support to Dark Mode on Windows 10.

Post by DebugBSD »

Hi catalin!

Thank you so much for your answer.

Regarding to the problem when cloning the repository, I attach an image to show yo the current problem.

Thanks!
Attachments
Captura2.png
Captura2.png (21.69 KiB) Viewed 14960 times
User avatar
DebugBSD
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Apr 30, 2020 6:15 am
Location: Madrid, Spain

Re: Support to Dark Mode on Windows 10.

Post by DebugBSD »

PB wrote: Thu Apr 30, 2020 9:24 am I will just add "the master link" for Dark Mode support on Win10
viewtopic.php?f=23&t=45869

I have never even heard of WinUI 3 but looking at it, it seems that adding its support to wxWidgets would be a major undertaking (i.e., a whole new toolkit) and maybe locked to using MSVC as the compiler.

And am I missing something or is WinUI 3 really based on Chromium? EDIT: No, fortunately it seems it is not.
Yeah! I had read that post, but, that was one year ago more or less. I had thought that maybe there was an advance.

Thanks anyway
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: Support to Dark Mode on Windows 10.

Post by PB »

DebugBSD wrote: Thu Apr 30, 2020 9:37 am Yeah! I had read that post, but, that was one year ago more or less. I had thought that maybe there was an advance.
Actually, that thread was updated just a couple weeks ago, stating that nothing has changed since the thread was created.

Additionally, I believe that an ongoing issue is best kept in a single thread; instead of creating new ones which ultimately only decreases signal-to-noise ratio for the topic.
redtide
In need of some credit
In need of some credit
Posts: 1
Joined: Thu May 06, 2021 3:59 pm

Re: Support to Dark Mode on Windows 10.

Post by redtide »

I faced this issue today and I tested the only resource I found regarding this context, which it's published at https://github.com/ysc3839/win32-darkmode/.
I tried it by adding the code in a modified version of wxFormBuilder, it seems it did some results only in menus and the scrollbar, using current stable 3.0.5 and development 3.1.5, compiled with MSVC 2019 and MSYS2 MinGW.

Image
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: Support to Dark Mode on Windows 10.

Post by PB »

See also this recent thread on wx-users: https://groups.google.com/g/wx-users/c/2V-UlBfmCSw
with an example of wxWidgets-based open source application attempting to implement dark mode: https://github.com/prusa3d/PrusaSlicer/ ... -821064152 If you download and run the app (PrusaSlicer-2.4.0-alpha0+156-win64-g4da8de5f4-202104162325.zip), you will see it is OKish at the first glance but has issues even I who never used dark mode can spot: frame system window menu, search and replace dialog, scrollbar in Help/System information dialog... OTOH, they do not claim it is perfect or finished.
AmadeusK525
Experienced Solver
Experienced Solver
Posts: 60
Joined: Wed Aug 19, 2020 12:04 am

Re: Support to Dark Mode on Windows 10.

Post by AmadeusK525 »

Hello,
I really appreciate this thread because Dark Mode support is really important to me. It's hard to withstand the strain caused by bright lights coming from the screen and I very much miss the ability to use Dark Mode on my applications.
I see some people speaking of something more than "just a fancy skin", and I feel like I might be missing something. To get around the fact that there is no native support for Dark Mode in wxMSW, I've just been setting the colours as I want them. See some screenshots:
Screenshot 2021-05-26 100302.png
Screenshot 2021-05-26 100124.png
Screenshot 2021-05-26 100124.png (32.07 KiB) Viewed 13412 times
Is there something inherently wrong with this approach? I remove the border of most controls with wxBORDER_NONE because they look bad, since they're always white. wxBORDER_SIMPLE looks good as well, but if used everywhere it may be too much. Having no borders means most of the eye queues for different "areas" are done by change in background colour. By the way, the wxButton doesn't get the hover/click visual effect if it has no border (which sucks), so, for it to look good and dynamic, I handle the enter/leave window events myself. This has been working well for me (although some controls have a mandatory border (like wxNotebook) and it doesn't look great, but I'll take what I can get. I haven't tested on MacOS yet (it's hard to get things working on a VM), so do you think it won't work there?

Oh, by the way, I plan to switch to using eranif's wxFlatMenu in the future. Maybe his Notebook implementation as well (although that doesn't support wxAui, so I may just have to create a new wxAuiTabArt class for when I need the wxAui interface).
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 465
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: Support to Dark Mode on Windows 10.

Post by New Pagodi »

AmadeusK525 wrote: Wed May 26, 2021 1:12 pm Oh, by the way, I plan to switch to using eranif's wxFlatMenu in the future. Maybe his Notebook implementation as well (although that doesn't support wxAui, so I may just have to create a new wxAuiTabArt class for when I need the wxAui interface).
On windows, you can override OnMeasureItem and OnDrawItem for menus to draw them as you want if you want to draw them with a dark theme.
AmadeusK525
Experienced Solver
Experienced Solver
Posts: 60
Joined: Wed Aug 19, 2020 12:04 am

Re: Support to Dark Mode on Windows 10.

Post by AmadeusK525 »

New Pagodi wrote: Wed May 26, 2021 2:50 pm On windows, you can override OnMeasureItem and OnDrawItem for menus to draw them as you want if you want to draw them with a dark theme.
I didn't know that, thank you for the tip! Although I suspect that, to keep the codebase more consistent, using the wxFlatMenu might be a better option (but may look worse). Oh and, about me "forcing" the Dark Mode with the background and foreground colours of the controls, do you think that's a bad idea?
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 465
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: Support to Dark Mode on Windows 10.

Post by New Pagodi »

AmadeusK525 wrote: Sun May 30, 2021 7:00 pm
New Pagodi wrote: Wed May 26, 2021 2:50 pm On windows, you can override OnMeasureItem and OnDrawItem for menus to draw them as you want if you want to draw them with a dark theme.
I didn't know that, thank you for the tip! Although I suspect that, to keep the codebase more consistent, using the wxFlatMenu might be a better option (but may look worse). Oh and, about me "forcing" the Dark Mode with the background and foreground colours of the controls, do you think that's a bad idea?
Given the lack of support/guidance microsoft has given for darkmode with WinAPI, I think developers can only do what they feel is best for their application.
Last edited by New Pagodi on Mon May 31, 2021 2:29 pm, edited 1 time in total.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Support to Dark Mode on Windows 10.

Post by ONEEYEMAN »

@New Pagoda,
You probably meant to reply, but didn't...

Thank you.
Post Reply