Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
Logos without a dark version keep a light tile in the dark theme
KnifeLemone2d2a2730f56
diff --git a/src/Filee.App/Views/SupportersView.axaml b/src/Filee.App/Views/SupportersView.axamlindex 3cac0a23..3d5c2847 100644--- a/src/Filee.App/Views/SupportersView.axaml+++ b/src/Filee.App/Views/SupportersView.axaml@@ -11,6 +11,13 @@<Setter Property="Background" Value="{DynamicResource SurfaceAltBrush}" /><Setter Property="BorderThickness" Value="0" /></Style>+ <!-- A logo without a dark version keeps a light tile in the dark theme -->+ <Style Selector="Button.supporter.lightOnly">+ <Setter Property="Background" Value="#F4F3F0" />+ </Style>+ <Style Selector="Button.supporter.lightOnly:pointerover /template/ ContentPresenter#PART_ContentPresenter">+ <Setter Property="Background" Value="#E9E7E2" />+ </Style></UserControl.Styles><StackPanel Spacing="6"><TextBlock x:Name="Title" Classes="label" Text="{DynamicResource sponsor.thanks}" />@@ -22,7 +29,7 @@</ItemsControl.ItemsPanel><ItemsControl.ItemTemplate><DataTemplate x:DataType="v:SupporterItem">- <Button Classes="supporter" Click="OnOpen" Tag="{Binding Url}" ToolTip.Tip="{Binding Name}">+ <Button Classes="supporter" Classes.lightOnly="{Binding LightOnly}" Click="OnOpen" Tag="{Binding Url}" ToolTip.Tip="{Binding Name}"><Panel><Image Source="{Binding Logo}" Height="{Binding $parent[v:SupportersView].LogoHeight}" MaxWidth="200" Stretch="Uniform"IsVisible="{Binding Logo, Converter={x:Static ObjectConverters.IsNotNull}}" />diff --git a/src/Filee.App/Views/SupportersView.axaml.cs b/src/Filee.App/Views/SupportersView.axaml.csindex 8399b69d..9b4e2aca 100644--- a/src/Filee.App/Views/SupportersView.axaml.cs+++ b/src/Filee.App/Views/SupportersView.axaml.cs@@ -9,7 +9,8 @@ using Filee.App.Services;namespace Filee.App.Views;/// <summary>A sponsor's logo (or its name when the logo is missing) and where it leads.</summary>-public sealed record SupporterItem(string Name, string? Url, Bitmap? Logo);+/// <param name="LightOnly">A logo without a dark version, shown in the dark theme: it keeps a light tile.</param>+public sealed record SupporterItem(string Name, string? Url, Bitmap? Logo, bool LightOnly = false);/// <summary>The sponsors' logos and the backers' names shipped with this release; hidden while there are none.</summary>public partial class SupportersView : UserControl@@ -53,8 +54,8 @@ public partial class SupportersView : UserControlIsVisible = !list.IsEmpty;var dark = Application.Current?.ActualThemeVariant == ThemeVariant.Dark;Logos.ItemsSource = list.Sponsors- .Select(s => new SupporterItem(s.Name, s.Url,- (dark ? s.LogoDark ?? s.Logo : s.Logo) is { } file ? logo(file) : null))+ .Select(s => (s, Logo: (dark ? s.LogoDark ?? s.Logo : s.Logo) is { } file ? logo(file) : null))+ .Select(x => new SupporterItem(x.s.Name, x.s.Url, x.Logo, dark && x.Logo is not null && x.s.LogoDark is null)).ToList();Logos.IsVisible = list.Sponsors.Count > 0;Names.Text = string.Join(" · ", list.Backers.Select(b => b.Name));diff --git a/tests/Filee.App.Tests/SupportersTests.cs b/tests/Filee.App.Tests/SupportersTests.csindex eee2c714..85507542 100644--- a/tests/Filee.App.Tests/SupportersTests.cs+++ b/tests/Filee.App.Tests/SupportersTests.cs@@ -66,4 +66,29 @@ public class SupportersTestsAssert.Null(acme.Logo); // a missing logo shows the name insteadAssert.Equal("Kim · Lee", view.Names.Text);}++ [AvaloniaFact]+ public void In_the_dark_theme_a_logo_without_a_dark_version_keeps_a_light_tile()+ {+ TestServices.EnsureInitialized("en");+ var app = Avalonia.Application.Current!;+ var theme = app.RequestedThemeVariant;+ app.RequestedThemeVariant = Avalonia.Styling.ThemeVariant.Dark;+ try+ {+ var view = new SupportersView();+ var read = new List<string>();+ view.Show(new SupporterList([new("Acme", null, "acme.png", "acme-dark.png"), new("Globex", null, "globex.png")], []),+ file => { read.Add(file); return new Avalonia.Media.Imaging.WriteableBitmap(new Avalonia.PixelSize(4, 2), new Avalonia.Vector(96, 96)); });++ var items = Assert.IsAssignableFrom<IEnumerable<SupporterItem>>(view.Logos.ItemsSource).ToList();+ Assert.Equal(["acme-dark.png", "globex.png"], read);+ Assert.False(items[0].LightOnly);+ Assert.True(items[1].LightOnly);+ }+ finally+ {+ app.RequestedThemeVariant = theme;+ }+ }}