-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Systray icon has insufficient contrast in Windows light themes #187
Comments
This is a trade-off between having sufficient cross-platform compatibility and the need to do lots of per-platform customisation. I use macOS, so have focused on that platform. With macOS it is possible to set menu bar (i.e., system tray) icons to be seen as "templates", which makes the OS treat them as a mask that is automatically modified in light/dark mode, rather than using the icon directly. I'm not sure if this is possible on Windows, but I'm happy to accommodate it if something like that exists. If not, you can change the colour of the icon here. |
To follow up, this small edit should make the icon colour react to the theme type (at startup only; not if you change theme while running the proxy). Could you add it here and let me know whether this works for you? icon_background_height = 44
icon_width = 40 # to allow for padding between icon and background image size
+ if sys.platform == 'win32':
+ import winreg
+ try:
+ key = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
+ r'Software\Microsoft\Windows\CurrentVersion\Themes\Personalize')
+ icon_colour = 'white' if winreg.QueryValueEx(key, 'AppsUseLightTheme')[0] == 0 else 'black'
+ except FileNotFoundError:
+ pass
+
# find the largest font size that will let us draw the icon within the available width
minimum_font_size = 1
maximum_font_size = 255 |
Thank you for the suggestions and proposed fixes. I have just switched to a new laptop, and I am still in the process of re-installing and configuring all my software; it will probably be some time before I get to the point of reinstalling Python and the required dependencies (in the meantime I am using your pre-built Windows binary). I am happy to test your proposed code once I have Python back on my new machine (and a little spare time), but there may be a bit of a delay until I get to that point — unless you somehow are able to provide me with an unofficial version of the emailproxy.exe binary compiled for Windows, which includes the above fix. Thank you! |
To make things easier, this change is now in the icon-colour branch. Let me know how you get on? |
Thank you, I will definitely report back with the results of my tests, once I have found some time to re-install Python and re-compile the code. |
Here's a preview build of this branch – could you let me know whether this works? |
Thank you for providing the preview build. Unfortunately it did not appear to work as intended. I tested this in a VM running Windows 10, using either the default "Windows" theme (which has a black taskbar) or the "Windows (Light)" theme (which has a light gray task bar). I also changed whether the icon appeared in the main systray area on the taskbar, or in the overflow area. To conduct each test, I exited the OAuth2 proxy, then made changes to the desktop theme or the icon location, and subsequently started the proxy. As seen in the screenshots below, the icon looks good in the light theme, but it now cannot be seen in the dark theme. So the original problem has been reversed. |
May I suggest checking the Registry value Alternatively, for a more low-tech solution, allow the user to set the icon color through a setting in |
Thanks for the pointer. Does this new version with that change work as expected for both theme types? |
It's close. This version makes the icon black when |
Great – third time lucky, then: how about this version? |
Excellent! Thanks for reporting this and for testing the various attempts to solve it. I'll merge this branch and it'll be in the next release. |
I've just installed the proxy on a new Windows 11 laptop, which came configured with a Windows "Light" theme that uses light background colors in the taskbar and elsewhere. The "OA" systray icon is designed to be white with a transparent background, and as a result, it is practically impossible to identify the icon unless I customize the Windows operating system to a darker theme:
I would suggest modifying the icon to give it sufficient contrast to work in both dark or light modes. One possibility is to add internal and external borders in a dark color, as illustrated in this mock-up:
Alternatively, change the icon color to something other than white.
Thanks!
The text was updated successfully, but these errors were encountered: