NetSparkleUpdater / NetSparkle

NetSparkle is a C#, cross-platform, highly-configurable software update framework with pre-built UI for .NET developers compatible with .NET 4.6.2/.NET 6+, WinForms, WPF, and Avalonia; uses Ed25519 signatures. View basic usage here in the README and try the samples for yourself.
https://netsparkleupdater.github.io/NetSparkle/
MIT License
606 stars 84 forks source link

UpdateAvailableWindow looks strange in Dark mode #351

Closed FRvanderVeen closed 1 year ago

FRvanderVeen commented 2 years ago

When using Avalonia in dark mode (in this case Fluent Dark) the UpdateAvailableWindow becomes unreadable: image This is because the UpdateAvailableWindow has a background configured: https://github.com/NetSparkleUpdater/NetSparkle/blob/42f21fdc8e8ab1af9ba747788b9e918e5d20d4fb/src/NetSparkle.UI.Avalonia/UpdateAvailableWindow.xaml#L14-L16 When removing the fixed background color, everything works as expected. The fixed background was added in the initial commit

Deadpikle commented 2 years ago

Hi @FRvanderVeen,

Thanks for reporting this.

Hmmmmmm, the hardcoded background there was to make it appear the same as WPF/WinForms, but you're right, that would mess up dark mode for Avalonia.

Not sure what the best fix would be at this exact moment to make it work on all themes out-of-the-box...in the interim you can always use your own IUIFactory that passes in your own UI, but that's extremely inconvenient for such a small problem.

Is there a fix that would make it look good out-of-the-box on all themes? (Simple light, simple dark, fluent light, fluent dark)? I guess we could hard code the text color and everything too, but that's also not ideal since users using dark mode should be able to enjoy dark mode... (A DynamicResource that gets overwritten by the fluent theme if the theme sets it?)

FRvanderVeen commented 2 years ago

I think the easiest solution is to remove the hardcoded background. That way you let the UI library determine how things look. I would expect that the update window looks the same as any Avalonia based window in my application.

For now I worked around the issue by attaching an event to the window opened event. Like so: https://docs.avaloniaui.net/docs/data-binding/binding-from-code#subscribing-to-a-property-on-any-object. That way I could remove the background on the grid. Besides that I also applied a fix for the titlebar that way. In dark mode titlebar is not in dark mode, which I found ugly. I now dynamically insert a textblock with the titlebar, because I set 'ExtendClientAreaToDecorationsHint' to true for all windows in my application, which also affects all SparkleUpdater windows

Deadpikle commented 1 year ago

Hi @FRvanderVeen,

I have kept the hardcoded background (for compat reasons just so nothing bad happens) but have made this easier for you to clear in 2.1.3-preview20220927001. The Avalonia UIFactory now has a UpdateWindowGridBackgroundBrush property that you can set to null to clear the background (or set it to whatever you feel like). Can you let me know if that helps? Thanks!

Deadpikle commented 1 year ago

Change rolling out now in CI/CD in version 2.1.3!

Deadpikle commented 1 year ago

FYI: 2.3.0 previews have a few new properties on the UIFactory that you may find helpful:

Deadpikle commented 1 year ago

Note that UseStaticUpdateWindowBackgroundColor is false in the 3.x preview versions (for Avalonia 11), so this won't be an issue by default in the future.