-
Notifications
You must be signed in to change notification settings - Fork 27
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
Menu bar doesn't follow dark/light theme on Windows #97
Comments
Win32 does not provide a dark menu bar. Need to go non-native for that. |
Win32 has Owner Drawn Menu Items where you basically draw everything by yourself from scratch but that only works for the submenus and not the menu bar itself, well, at least officially. There is some undocumented APIs to also draw the menu bar from scratch and I got pretty good result with it. Here is a screenshot where the menu bar color matches the title bar color(hard coded for now): I could add on to this and also draw the submenu but I feel it is not necessary, and it is better to keep it white. The thing is, Windows has an option "Show accent color on titlebar and window borders" and if it is "ON", I can get that color and apply to the menu bar too but if it is "OFF", I need to fallback to the default color but I need to know when that option is toggled on and off, and currently I don't know of a way to get notified about that option getting changed. And even if I get notified about that option getting toggled, I still don't know of a way to get the default color for active and inactive titlebar. To what this feature needs in order to be implemented:
|
I was trying to migrate one of my project from Electron to Tauri recently and when I was trying out the menu bars I found this post. When I'm on Windows using dark theme and "Show accent color on titlebar and window borders" OFF, electron would show white titlebar with dark menubar. @amrbashir Thanks a lot for contributing to the awesome Tauri project. I just have some follow-up questions regarding your comment.
Regarding your comment that menubar may use accent color if "Show accent color on titlebar and window borders" is "ON", I'm a little confused, because the setting only mentions titlebar and window borders which doesn't include using accent color for menu bar. I'm not an expert of window or UI desgin, and I just want to present my observation. By comparing some Windows Applications with similar menu bar styles to Tauri window like (apps built with Electron using menu bar and Notepad++)
I wonder would it be possible for TAO to use the same detection method for titlebar dark theme and change the menu bar color when dark theme is applied? Thank you! |
This can be done. Reading your comment, I think you misunderstood me completely, maybe my wording wasn't clear. I am not talking about title bars colors because they work perfectly, I was talking about matching the menubar color to the titlebar color whether it is using the default (black/white) color or the accent color (when "Show accent color on titlebar and window borders" is "ON") or when it is inactive (which has a slightly different color).
yeah that's probably because they can't also detect when the I think what we can just do the following:
|
* feat(windows): draw dark menubar if necessary closes #97 * Update Cargo.toml
I saw the linked PR was merged, but I wasn't sure if the feature was added to to v1.* or if this is to be included in v2. I'm currently working in v1 now, and I'm finding that on Windows, even with both my OS and my window theme set to dark mode, while the title bar theme seems to behave correctly, my menu bar is consistently showing up in light mode colors. If someone could point me to any configs I might have missed or if this feature is available in v1 at all or if there's a solid workaround in v1, I'd greatly appreciate it. |
That's for v2, v1 will stay as is |
Is it included in the beta release of V2 that was announced earlier this month? |
yeah, it is included |
The window title bar follows dark/light them on Windows nicely but not the menu bar.
Is it possible to do or a limitation of win32 api?
The text was updated successfully, but these errors were encountered: