racket / drracket

DrRacket, IDE for Racket
http://www.racket-lang.org/
Other
454 stars 93 forks source link

Visibility issues with Dr Racket and dark themes #235

Closed pmplant closed 4 years ago

pmplant commented 6 years ago

Some elements of the UI, particularly the error message in the lower left, are difficult to see on a dark theme. I could not any way to customise these elements under preferences.

screenshot at 2018-10-21 16-02-16

rfindler commented 4 years ago

Unfortunately this is the way it currently is. Many of the light/dark places react immediately, some react on a new window and some react only on restart. (It is an issue for sure! Just not on anyone's list to fix at the moment as far as I know.)

Robby

On Wed, Apr 15, 2020 at 12:12 PM Liwei Chou notifications@github.com wrote:

I have the same problem. If you keep DrRacket open on MacOS, the text color will be wrong when the system theme is changed from "Light Mode" to "Dark Mode" or vise-versa. The text on the toolbar and bottom(such as memory usage) is difficult to read.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/racket/drracket/issues/235#issuecomment-614165347, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADBNMETQOG4S6W5TJTO2XDRMXTGZANCNFSM4F6RQC5Q .

jcolivo commented 4 years ago

Hello Racket Team, I appreciate all the hard work on trying to improve the dark mode in DrRacket. Thank you.

Just hoping that you won't forget us Windows users. ;-) My issues are as pointed out in this thread: https://groups.google.com/forum/#!topic/racket-dev/xYjE9JCe9u0

If there is anything I can do to help (I'm not a programmer, but can certainly help with testing), please let me know.

Have a wonderful weekend!

rfindler commented 4 years ago

Yeah, the windows situation isn't great. I think that basically all of the problems there can be traced to not knowing how to implement this function under windows:

https://docs.racket-lang.org/mrlib/White_on_Black_Panel_Predicate.html

If you have knowledge of windows internals or the strength to dig through the various google results on the topic and come up with something, that would be huge!

jcolivo commented 4 years ago

I certainly would like to contribute. While I'm not a software engineer (just a simple-minded microeconomist), I can start looking around to see what solutions are viable; plus, I'm curious about this kind of development.

Wish me luck.

default-kramer commented 4 years ago

Yeah, the windows situation isn't great. I think that basically all of the problems there can be traced to not knowing how to implement this function under windows:

https://docs.racket-lang.org/mrlib/White_on_Black_Panel_Predicate.html

If you have knowledge of windows internals or the strength to dig through the various google results on the topic and come up with something, that would be huge!

The docs on white-on-black-panel-scheme? say "This predicate is intended to determine if the underlying operating system is in a “dark” mode." Despite being a regular Windows user, I didn't know that Windows had such a setting until I googled it just now and found this: https://www.cnet.com/how-to/how-to-enable-dark-mode-in-windows-10/

@rfindler , is the desired behavior on Windows 10 that white-on-black-panel-scheme? looks at that "Choose your default app mode" setting (see cnet link above)? Because I would not have expected that setting to have any effect on DrRacket. I thought that all the coloring decisions were based on the Edit -> Preferences -> Colors menu in DrRacket.

If you want the "Choose your default app mode" setting, I'm pretty sure that I can find it in the Windows registry somewhere. (In fact, this looks like it: https://stackoverflow.com/questions/51334674/how-to-detect-windows-10-light-dark-mode-in-win32-application) I can try to make a PR for mrlib if this is the desired behavior. I don't have any older versions of Windows handy, so it will likely support Win10 only.

rfindler commented 4 years ago

Maybe we need a new PR/Issue for this specific problem?

@default-kramer the operating system controls the drawing of the system controls (like buttons and menus and panels). DrRacket controls other things (like the editor window).

rfindler commented 4 years ago

Hi Alex: I think that's a great start. (I think we probably also want testing to know which versions of Windows it works on.)

On Sat, Apr 25, 2020 at 5:26 PM Alex Harsányi notifications@github.com wrote:

The registry key AppsUseLightTheme in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize, will be 1 or missing if applications use the "light" theme and will be 0 if the applications should use a dark theme.

I verified that AppsUseLightTheme changes to 0 if I select "dark" mode in my preferences on my Windows 10 machine. The key is missing if "Dark" mode was never selected on a machine.

white-on-black-panel-scheme? could just look for this key on Windows?

Source: https://stackoverflow.com/questions/51334674/how-to-detect-windows-10-light-dark-mode-in-win32-application

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/racket/drracket/issues/235#issuecomment-619448758, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADBNMHGKRMWQ652DTF6BLTRONPSDANCNFSM4F6RQC5Q .

mflatt commented 4 years ago

More ideas for dark mode on Windows based on various undocumented flags and functions: https://github.com/mflatt/gui/commit/fd38e768670c46975fbaba3ca6f8db145c0e4bd3

Last time I looked at this, I concluded that system Win32 control classes like buttons or checkboxes (I forget which, but I think it was buttons) don't support dark mode.

jcolivo commented 4 years ago

I only have access to 64 bit Windows 10, so I can help with testing on that system.

As for Windows 7 and 8, dark mode was never supported on those versions except within later versions of Google Chrome and via 3rd party software modding (please correct me if I am wrong); therefore, I think Windows 10-only support for dark mode would be perfectly fine, and even expected by users of older Windows versions.

It's interesting that there were issues with Win32 control classes. I wonder if they have been fixed in the recent Windows 10 updates? I'm looking around for clues.

sleepnova commented 4 years ago

Don't know if this could help? A code snippet to listen to mode change events on MacOS. https://github.com/LinusU/DarkModeListener

Unfortunately this is the way it currently is. Many of the light/dark places react immediately, some react on a new window and some react only on restart. (It is an issue for sure! Just not on anyone's list to fix at the moment as far as I know.) Robby On Wed, Apr 15, 2020 at 12:12 PM Liwei Chou @.***> wrote: I have the same problem. If you keep DrRacket open on MacOS, the text color will be wrong when the system theme is changed from "Light Mode" to "Dark Mode" or vise-versa. The text on the toolbar and bottom(such as memory usage) is difficult to read. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#235 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADBNMETQOG4S6W5TJTO2XDRMXTGZANCNFSM4F6RQC5Q .

rfindler commented 4 years ago

That's helpful! But I would guess that the bulk of the problem is making sure that all of the places that have drawing that depends on the wob/bow state properly get send redraw requests when the drawing changes (and that that drawing state is properly consulted at the right time (not, eg, when an object is created, say, but when it is drawn). With the current code, it is just an issue of going through all of the places one by one and looking for things to fix. :(

jcolivo commented 4 years ago

I found the Windows Registry Key as @default-kramer mentioned above referencing the StackOverflow thread: https://stackoverflow.com/questions/51334674/how-to-detect-windows-10-light-dark-mode-in-win32-application

If you want the "Choose your default app mode" setting, I'm pretty sure that I can find it in the Windows registry somewhere. (In fact, this looks like it: https://stackoverflow.com/questions/51334674/how-to-detect-windows-10-light-dark-mode-in-win32-application) I can try to make a PR for mrlib if this is the desired behavior. I don't have any older versions of Windows handy, so it will likely support Win10 only.

On my system (64 bit Windows 10, latest version), I verified the location of the registry key: Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize

This is a screenshot of the key when light theme is chosen. Notice the ApsUseLightTheme value set at 0x00000001 (1) Light Theme On

This is a screenshot of the key when dark theme is chosen. Notice the ApsUseLightTheme value now set at 0x00000000 (0) Light Theme Off

Would this feature require Racket code to look for this specific registry key value, or would the code be written at a lower level?

sorawee commented 4 years ago

Here's one more issue:

Screen Shot 2020-07-12 at 08 11 11

The last "Extra regexp" somehow has white background, though only on characters.

rfindler commented 4 years ago

This issue is a bit of a mess because it has so many different things going on and many of them are already fixed.

I'm going to create a new racket/gui issue and copy windows issues over there and create a new issue for @sorawee 's recent comment and then just close this one.