Skip to content
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

enhance(windows): apply dark mode to menus and other controls #751

Merged
merged 4 commits into from
Aug 14, 2023
Merged

enhance(windows): apply dark mode to menus and other controls #751

merged 4 commits into from
Aug 14, 2023

Conversation

ahodesuka
Copy link
Contributor

@ahodesuka ahodesuka commented Jun 24, 2023

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Docs
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

Checklist

Other information

The current dark mode only applies to the window titlebar. An additional undocumented function
from uxtheme.dll must be called for the menus to appear with the dark theme.

The function that must be called has changed once since being introduced, in Windows 10 version 1903 (build 18362),
this latest version allows you to force the theme color you want instead of just allowing dark to
be set if it is the system default.

From what I have tested this works for system tray menus, menubar menus, and the system menu when right clicking the titlebar as seen below.
image

A somewhat related issue is tauri-apps/muda#97 although this issue seems to be more about the menubar control itself and not the menus.

Also closes tauri-apps/tauri#6645

@ahodesuka ahodesuka requested a review from a team as a code owner June 24, 2023 00:41
@wusyong
Copy link
Member

wusyong commented Jun 25, 2023

Not sure how will this work with external crate like muda since we plan to move menu feature into this crate.
@amrbashir could you help review this?

@ahodesuka
Copy link
Contributor Author

This should work with muda and probably belongs in tao since it is in charge of managing themes.

@amrbashir
Copy link
Member

amrbashir commented Jun 26, 2023

Not sure how will this work with external crate like muda since we plan to move menu feature into this crate. @amrbashir could you help review this?

I will try to review ASAP (currently on a sick leave and some national holidays coming) but I agree with @ahodesuka, I think it is better to keep this in tao since it has info about the theme management and would be redundant to implement both in tao and muda, However, I think muda should add an easy API to call this undocumented method, so crates other than tao could call it whenever they want.

@amrbashir
Copy link
Member

Actually since we don't plan on releasing this for 1.x, lets just implement this in muda and let tauri decide if it wants to use this API, does that sound alright?

@ahodesuka
Copy link
Contributor Author

Looking at it now I think you are right. It should be implemented in muda and should perhaps expand to theme the menubar itself as well.
I found a quick example here in ppsspp that uses the method you mentioned in tauri-apps/muda#97, but uses the theme menu color avoiding the use of any hard coded values.

@amrbashir
Copy link
Member

Yeah sounds good, feel free to open a PR there.

@amrbashir amrbashir closed this Jun 27, 2023
@amrbashir
Copy link
Member

After taking a second look, I was wrong, this API that switches the context menu should be called in tao and the custom drawing of the menubar should be in muda.

@amrbashir amrbashir reopened this Aug 13, 2023
@amrbashir amrbashir changed the title fix(windows): Apply dark mode to menus enhance(windows): apply dark mode to menus and other controls Aug 14, 2023
Copy link
Member

@amrbashir amrbashir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahodesuka thanks for your contributions and I apologize for dismissing the PR earlier without a deeper look.

@amrbashir amrbashir merged commit 6df56c2 into tauri-apps:dev Aug 14, 2023
9 checks passed
@github-actions github-actions bot mentioned this pull request Aug 14, 2023
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] theme customization for system tray [feat] Dark Right Click menus
3 participants