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

Show a dark title bar when a dark theme in ILSpy is selected #2950

Closed
tom-englert opened this issue Apr 6, 2023 · 11 comments · Fixed by #2948
Closed

Show a dark title bar when a dark theme in ILSpy is selected #2950

tom-englert opened this issue Apr 6, 2023 · 11 comments · Fixed by #2948
Labels
Enhancement Areas for improvement UI

Comments

@tom-englert
Copy link
Contributor

As of Windows 11 there is a possibility to change the color of the windows title bar.

"DWMWA_USE_IMMERSIVE_DARK_MODE" is supported starting with Windows 11 Build 22000.
learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute

This could be used to let the title bar color follow the ILSpy color theme.

Also maybe an option could be using DWMWA_CAPTION_COLOR and DWMWA_TEXT_COLOR to set the colors explicit according to ILSpy them.

@christophwille
Copy link
Member

christophwille commented Apr 6, 2023

I have read the various comments in the PR #2947. Let's look at this from the user's point of view: if I switch a theme in ILSpy, I expect consistent behavior regardless of the OS's settings regarding light/dark. So, me being light in Win11, selecting dark in ILSpy, I would expect the title bar to follow - and not like in the PR be a no-op ("Style the window title bar" is meeting that expectation).

@tom-englert
Copy link
Contributor Author

Also just tried a simple sample app, using DWMWA_USE_IMMERSIVE_DARK_MODE.
It will do what is expected, despite the confusing documentation: https://learn.microsoft.com/en-us/answers/questions/966330/dwmwa-use-immersive-dark-mode-confusion

However I only managed to get a pitch-black title bar, no matter what my windows settings are:
image

So if we anyhow ignore the windows theme settings, it would look better if we set the color individually.

@christophwille
Copy link
Member

christophwille commented Apr 6, 2023

So if we anyhow ignore the windows theme settings, it would look better if we set the color individually.

Simply floating a few ideas: Can we query the OS light/dark colors? What I am getting at is for a theme to say "Give me the system-default dark look for the chrome" (even if light is current) vs additionally "Hey, this is the color to use" (think VS blue theme).

@tom-englert
Copy link
Contributor Author

I tried SystemParameters.WindowGlassColor, but this gives me the same black - but maybe that's because I'm on a VM via remote desktop.
The screen shot @SlimeNull has posted looks quite different.

@SlimeNull
Copy link

Also just tried a simple sample app, using DWMWA_USE_IMMERSIVE_DARK_MODE. It will do what is expected, despite the confusing documentation: https://learn.microsoft.com/en-us/answers/questions/966330/dwmwa-use-immersive-dark-mode-confusion

However I only managed to get a pitch-black title bar, no matter what my windows settings are: image

So if we anyhow ignore the windows theme settings, it would look better if we set the color individually.

image
If you enable this option in the settings, then the Mica effect will not be applied to your title bar.

@SlimeNull
Copy link

And I noticed that your window border is not rounded, is there no problem with the graphics card driver? Or are rounded borders disabled or some visual effects?

@SlimeNull
Copy link

So if we anyhow ignore the windows theme settings, it would look better if we set the color individually.

Simply floating a few ideas: Can we query the OS light/dark colors? What I am getting at is for a theme to say "Give me the system-default dark look for the chrome" (even if light is current) vs additionally "Hey, this is the color to use" (think VS blue theme).

I am also curious. Visual Studio customized the title bar, but its "layout options" are still available.

@SlimeNull
Copy link

In addition, I have a suggestion. Currently, ILSpy has two themes, Light and Dark. Can we introduce an "Auto" mode? When the system theme changes, it automatically switches to the target mode. In WPF, we only need to subscribe to the SystemEvents.UserPreferenceChanged event.

@tom-englert
Copy link
Contributor Author

tom-englert commented Apr 6, 2023

And I noticed that your window border is not rounded, is there no problem with the graphics card driver? Or are rounded borders disabled or some visual effects?

Yes, that's probably because its a VM, not a real machine, so my investigations here might not be fully valid.
So on a physical machine this seems to work as expected.

@tom-englert
Copy link
Contributor Author

tom-englert commented Apr 6, 2023

I am also curious. Visual Studio customized the title bar, but its "layout options" are still available.

Can be fixed via #2955

@tom-englert
Copy link
Contributor Author

In addition, I have a suggestion. Currently, ILSpy has two themes, Light and Dark. Can we introduce an "Auto" mode? When the system theme changes, it automatically switches to the target mode. In WPF, we only need to subscribe to the SystemEvents.UserPreferenceChanged event.

Good point, but this would be a different issue.

@tom-englert tom-englert mentioned this issue Apr 10, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Enhancement Areas for improvement UI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants