-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Added support for Mica Light & Dark based on Win11 #12196
Conversation
src/Windows/Avalonia.Win32/WinRT/Composition/WinUiCompositionShared.cs
Outdated
Show resolved
Hide resolved
Looks promising, lack of proper Mica is a huge gap in Avalonia, especially on Windows 11! |
/// </summary> | ||
public static WindowTransparencyLevel Mica { get; } = new(nameof(Mica)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this value is a breaking change and can't be accepted mid 11.x.
Would be reasonable to keep singe "Mica", but change it behavior depending on the window theme variant?
See
public unsafe void SetFrameThemeVariant(PlatformThemeVariant themeVariant) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mica should automatically switch based on theme variant. I don't think there should be two entries for this and there aren't in WinUI either I believe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it, wrote it before ThemeVariants were available :D
Avalonia compositor is not going to replace WinUI one. They work similarly, but one works on a framework level, and another works on OS level, where we can't have full control. |
Sure, don't have full control but also it will be a fully cross-platform implementation by migrating to the Avalonia one. Removing WinUI composition behind the scenes as many places as possible does actually seem like the right move in a cross-platform framework. |
WinUI compositor is used onpy and only on windows. And only to prepare a surface to render into + a refresh timer. Avalonia compositor is well abstracted from that, and only is compositiing avalonia visuals. |
Changed it to be based on theme variant :) |
You can test this PR using the following package version. |
What does the pull request do?
Add support for Mica Light and Dark based on how it looks in Windows 11
What is the current behavior?
The Mica blur is very simple and does not allow for same feel as other Windows 11 apps.
Note
I had this implementation for a while in Fluent Search, and did not push it here as I thought Avalonia composition will eventually replace WinUI one (maybe I misunderstood).
Currently this Light/Dark is based on
WindowsTransparencyLevel
as it was the only way I found for end-user to be able to interact with WinUI stuff outside of program startup.I am open for suggestions about changing it.
Light
Dark
Checklist
Breaking changes
Breaks the current
Mica
value forWindowsTranspencyLevel
.Obsoletions / Deprecations
Fixed issues
#10719