pkulchenko / ZeroBraneStudio

Lightweight Lua-based IDE for Lua with code completion, syntax highlighting, live coding, remote debugger, and code analyzer; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and other Lua interpreters on Windows, macOS, and Linux
http://studio.zerobrane.com/
Other
2.6k stars 519 forks source link

Windows 10 dark mode theme not applying to ZeroBrane #1101

Closed dexmar closed 3 years ago

dexmar commented 3 years ago

I have Dark Mode set for apps in ZB in Windows 10. With the SciTeLuaIDE theme selected my code window, Project, and Output windows are all black but the areas marked here

https://github.com/pkulchenko/ZeroBraneStudio/issues/865

are the default gray as in the Light Mode for Windows.

Is this area not able to be set in Win 10 as I am able to on Mac and Linux?

Thanks!

pkulchenko commented 3 years ago

@dexmar, I'm a bit confused about this issue. Are you saying that you selected the dark theme in the IDE itself, but some of the areas (as shown in #865) have not changed their colors to dark? If so, then this is expected, as those areas are colored based on system colors and this behavior is consistent across Windows, macOS, and Linux. If you select the dark theme in the OS itself, then the IDE will use those colors for borders, sash, and everything else too. If that's not the case, please post the actual screenshot.

dexmar commented 3 years ago

@pkulchenko Oh my, that was the worst post ever, sorry about that. Yes, totally confusing.

Let me try again. I have Windows 10 set to Dark Mode. Other programs I use (browsers, editors, etc) display the Dark Mode theme uniformly as expected; the Title bar is a dark shade of gray, tabs are a lighter shade of gray, etc. Here is an example of the Brave browser:

brave

On my Mac, Dark Mode works as expected:

Screen Shot 2021-01-07 at 11 09 55 PM

But on Windows 10, Dark Mode is only partially applied:

zerobrane

Is that as good as it gets with Windows 10 as far as the application of Dark Mode?

Again, thanks! Ed

decuant commented 3 years ago

Hi,

on my win 10, Opera is black as your Brave, but the title bar of folders is violet and so is ZeroBrane and any other application I just tested. The application's title bar becomes white when in background, which looks like the screenshot you posted.

Just my experience.

Thanks

Antonio

pkulchenko commented 3 years ago

@dexmar, it's possible that the system colors are not picked correctly, although it's not likely. Can you run the commands in the Local console from this comment and report back the results.

Also, it's also possible to change the color of the tab background and the font by adding this code to the config, but it's a bit hackish, as it should be picked up from system colors.

dexmar commented 3 years ago

@pkulchenko I'll do that tomorrow. Thanks for the help!

dexmar commented 3 years ago

Here is the output of the commands:

wx.wxSystemSettings.GetColour(wx.wxSYS_COLOUR_3DFACE):GetAsString() "rgb(240, 240, 240)"

wx.wxSystemSettings.GetColour(wx.wxSYS_COLOUR_CAPTIONTEXT):GetAsString() "black"

wx.wxSystemSettings.GetColour(wx.wxSYS_COLOUR_INACTIVECAPTIONTEXT):GetAsString() "black"

pkulchenko commented 3 years ago

So the colors correspond to what we see on the screenshot: the background is white-ish and the text is black. I'm not sure why it doesn't correspond to the colors you configure in the OS theme, but the behavior of the IDE looks correct (if the results you are showing are to be believed).

dexmar commented 3 years ago

Hmm, that's curious as I thought Zerobrane would pull from the underlying OS theme as it does on the Mac. Are there "Set" commands similar to those Get commands I put into the console to set the theme manually? It doesn't seem like a big deal but I find the mismatched theming distracting.

pkulchenko commented 3 years ago

Unfortunately there are no corresponding Set commands. I opened a ticket to add those for wxwidgets a while ago, but it hasn't been implemented and I'm not in a position to implement it yourself.

You can change the tab background/font colors using those hack-ish suggestions in the ticket I referenced. You can hide the statusbar and the toolbar to keep the colors more consistent, but I still find it strange that the reported colors don't correspond to the OS theme colors. I guess I'll have to find win10 instance to explore it further. Unfortunately, since this is done somewhere inside wxwidgets, it'll have to be addressed there (if there is indeed an issue).

dexmar commented 3 years ago

@pkulchenko Thank you for your time on this matter. Do you know if anyone has been able to get a uniform look to ZB on Windows 10 dark mode as in the picture above from the Mac? Is my system an outlier here?

BTW, I did install ZB on my sons XPS laptop and the colors were the same as in my picture above. Also, running the commands listed above yielded the same output. Either I am consistent in what I am doing wrong or the widget library is not setting the underlying OS theme correctly.

Additional info: both my desktop and his laptop are running Win 10 Version 1909. Not sure what the latest is but I know there are newer versions. I'll upgrade my desktop to the latest version and report back.

Again, thank you for your time on this!!

dexmar commented 3 years ago

So in digging a bit, evidently wxWidgets for Windows is built using Win32 API which is not covered by Microsoft's theming system so as such is not currently able to be themed by the Dark Theme setting in Windows. This can be seen in other Win32 programs: notepad, wordpad, device manager, etc. As that is the case there is no further need to spend any time on this thread @pkulchenko

Thank you for your time!

dexmar commented 3 years ago

Well, FWIW updating to the latest Windows 10 (20H2) got things a little closer! The Title Bar is now dark!!

ZeroBrane-u
pkulchenko commented 3 years ago

Interesting; thank you for the update! I agree with you on win32 integration for wxwidgets, so we may be out of luck until there is better support for Windows theming in wxwidgets (or MS adds compatibility for win32 support).

Please keep updating this if you notice any other changes (even if the ticket is closed, as we can continue the discussion).

dexmar commented 3 years ago

Will do, thanks.

noncom commented 2 weeks ago

@pkulchenko, what's the status of this? I made a small research about the topic, and here's what I've got. Not sure if I'm missing anything, but it seems that the new version of wxWidgets should already solve the issue?

If you open https://github.com/wxWidgets/wxWidgets/blob/master/src/msw/settings.cpp#L383, you will see there are some methods for determining if the theme is dark or not.

So I have my Windows 10 system set to full dark mode, and in ZeroBrane I try:

>> wx.wxSystemSettings.GetAppearance():IsDark()
false
>> wx.wxSystemSettings.GetAppearance():AreAppsDark()
[string "wx.wxSystemSettings.GetAppearance():Ar..."]:1: attempt to call method 'AreAppsDark' (a nil value)
>> wx.wxSystemSettings.GetAppearance():IsSystemDark()
[string "wx.wxSystemSettings.GetAppearance():Is..."]:1: attempt to call method 'IsSystemDark' (a nil value)

So from this it's evident that:

Investigating the second point I see that these methods were added two years ago on Dec 26, 2022 :

Which effectively means that:

So the concluding question: is ZeroBrane using an old version of wxWidgets? Would it be possible to use the latest one?


Additional info