As Ghisler wrote clearly in the course of this thread, the upcoming version will support the Win 10 API functions for dark mode. And since he does it based on a Github sample for Win32 apps, the user is asking for a hint on how to do that on his own application. Quite legitimate, actually.
- Site Admin
- Posts: 38749
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
It's not easy. For some controls like listboxes, you can simply call
Others need to be owner drawn by yourself.
Also make sure to call AllowDarkModeForApp BEFORE opening any forms, otherwise context menus will be wrong.
But it's a LOT of work, I've been working on that for months now...
Here is how I load the special functions:
Code: Select all
type tIsDarkModeAllowedForApp=function:bool; stdcall; tShouldAppsUseDarkMode=function:integer; stdcall; // only bit 1! tAllowDarkModeForWindow= function(a_HWND:HWND;a_Allow:boolean):bool; stdcall; tAllowDarkModeForApp=function(mode:integer):bool; stdcall; var IsDarkModeAllowedForApp:tIsDarkModeAllowedForApp=nil; ShouldAppsUseDarkMode:tShouldAppsUseDarkMode=nil; AllowDarkModeForWindow:tAllowDarkModeForWindow=nil; AllowDarkModeForApp:tAllowDarkModeForApp=nil; IsDarkModeAllowedForApp:=GetProcAddress(themelib, MAKEINTRESOURCE(139)); ShouldAppsUseDarkMode:=GetProcAddress(themelib, MAKEINTRESOURCE(132)); AllowDarkModeForWindow:=GetProcAddress(themelib, MAKEINTRESOURCE(133)); AllowDarkModeForApp:=GetProcAddress(themelib, MAKEINTRESOURCE(135));
- Junior Member
- Posts: 19
- Joined: 2007-09-15, 14:53 UTC
- Location: Noord-Brabant, The Netherlands
I also found this Pascal example: https://www.haijin-boys.com/wiki/ダークモード対応
I can get the main menu items dark, but not the main menu itself. And I think it's strange you have to set the color of the forms yourself... Perhaps I'm doing something wrong.
Good luck with testing TC 9.5.
Maybe it's because TC has a very "liney" interface There are a lot of lines everywhere, to separate elements, rather than using background colours or spacing, or other ways to separate elements. Sometimes just glueing things together is fine, too. Designing GUI's is a subtle practice, and definitely not easy.
Maybe it's a good idea to take a look at the dark mode of a popular code editor, Visual Studio Code (not Visual Studio!). They've absolutely *nailed* dark mode, and I think TC could (or should) at least borrow some ideas from VS Code.
Some differences in design language are to be expected.
IMHO (and such things will always be a matter of personal preference), I greatly prefer Total Commander's current dark mode to any other file managers' attempts at the same, and also prefer this old-school native look to the current trend for space-wasting webby interfaces.
Of course, I am an ancient relic when it comes to computers, so what do I know.
(I suspect the average age of Total Commander users to be somewhat advanced.)
I really don't think the programming language, or UI framework for that matter, needs to make much of a difference. In the end the application typically has full control over how a control draws itself. In my past life I've been hobby'ing with Delphi and I know it's not easy, but certainly doable, to make "native" controls draw themselves completely differently.
I also really don't think GUI style/layout is *completely* a matter of personal preference. There aren't whole studies about UI and UX design for nothing, and the extent to how well a UI works is completely measurable by usertesting. This is how many high-budget programs get an excellent UI. Low-budget programs tend to go with community-driven testing, as well as designers willing to donate some of their time.
That last part is difficult for TC to pull off, because of its "closed" nature. It's not opensource, is it. TC has always felt like a one man show (not sure if it is), which results in UI that tends to have a strange learning curve, or a slow pace towards something really good and awesome. Not entirely sure how (and if) TC should deal with this kind of issue.