From 9f9051888a41833bbbd09056644b4b39971e48b4 Mon Sep 17 00:00:00 2001 From: cre8ive-marketing <168519979+cre8ive-marketing@users.noreply.github.com> Date: Sun, 25 Oct 2026 12:31:27 +0530 Subject: [PATCH] Plain buttons: the surface with a thin border, unlike a disabled box (#524) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Revert, Browse… and the other plain buttons had the same flat grey as a disabled field next to them. They now take the surface they sit on with a thin border, in the app and in Setup (which shares Soft.axaml). Material You and a theme.json surface colour them too. --- src/Filee.App/Services/ThemeService.cs | 5 ++++ src/Filee.App/Styles/Soft.axaml | 15 ++++++++++ .../Filee.App.Tests/MaterialYouThemeTests.cs | 29 +++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/src/Filee.App/Services/ThemeService.cs b/src/Filee.App/Services/ThemeService.cs index 604475a33..55fc9399b 100644 --- a/src/Filee.App/Services/ThemeService.cs +++ b/src/Filee.App/Services/ThemeService.cs @@ -171,6 +171,11 @@ private static void ApplyCustomOverrides(IResourceDictionary dictionary, IReadOn foreach (var (name, value) in colors ?? new Dictionary()) if (CustomBrushKeys.TryGetValue(name, out var key) && Color.TryParse(value, out var color)) dictionary[key] = new SolidColorBrush(color); + // Plain buttons are the surface they sit on (#524): also under Material You and a theme.json's own surface. + if (dictionary.TryGetValue("SurfaceBrush", out var surface)) + dictionary["ButtonBackground"] = surface; + if (dictionary.TryGetValue("SurfaceAltBrush", out var surfaceAlt)) + dictionary["ButtonBackgroundPointerOver"] = surfaceAlt; } /// Replaces (or, with no colours, removes) the user's colours for one variant. diff --git a/src/Filee.App/Styles/Soft.axaml b/src/Filee.App/Styles/Soft.axaml index 5a6269dd2..d6b28b2c6 100644 --- a/src/Filee.App/Styles/Soft.axaml +++ b/src/Filee.App/Styles/Soft.axaml @@ -27,6 +27,15 @@ + + + + + + + + @@ -44,6 +53,12 @@ + + + + + + diff --git a/tests/Filee.App.Tests/MaterialYouThemeTests.cs b/tests/Filee.App.Tests/MaterialYouThemeTests.cs index 75a75c93f..22aba0232 100644 --- a/tests/Filee.App.Tests/MaterialYouThemeTests.cs +++ b/tests/Filee.App.Tests/MaterialYouThemeTests.cs @@ -198,6 +198,35 @@ public void ThemeService_respects_custom_theme_json_overrides() var darkSurface = Assert.IsType(darkDict["SurfaceBrush"]); Assert.Equal(Color.Parse("#654321"), darkSurface.Color); + + // Plain buttons follow the theme's surface (#524), not the Soft look's white. + Assert.Same(lightSurface, lightDict["ButtonBackground"]); + Assert.Same(darkSurface, darkDict["ButtonBackground"]); + Assert.Same(lightDict["SurfaceAltBrush"], lightDict["ButtonBackgroundPointerOver"]); + } + finally + { + themeService.Apply(new ThemeSettings(), "en"); + } + } + + [AvaloniaFact] + public void Plain_buttons_are_the_surface_with_a_border_unlike_a_disabled_box() + { + TestServices.EnsureInitialized("en"); + var themeService = AppHost.Get(); + try + { + foreach (var style in new[] { ThemeStyle.Soft, ThemeStyle.MaterialYou }) + { + themeService.Apply(new ThemeSettings { Style = style }, "en"); + foreach (var variant in new[] { ThemeVariant.Light, ThemeVariant.Dark }) + { + Assert.Equal(ResolveBrush("SurfaceBrush", variant).Color, ResolveBrush("ButtonBackground", variant).Color); + Assert.Equal(ResolveBrush("SurfaceAltBrush", variant).Color, ResolveBrush("ButtonBackgroundPointerOver", variant).Color); + Assert.True(ResolveBrush("ButtonBorderBrush", variant).Color.A > 0); + } + } } finally {