Skip to content

armgit / Filee

Public Imported from GitHub
0

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.

Plain buttons: the surface with a thin border, unlike a disabled box (#524)

cre8ive-marketing9f9051888a41
diff --git a/src/Filee.App/Services/ThemeService.cs b/src/Filee.App/Services/ThemeService.cs
index 604475a3..55fc9399 100644
--- a/src/Filee.App/Services/ThemeService.cs
+++ b/src/Filee.App/Services/ThemeService.cs
@@ -171,6 +171,11 @@ public sealed class ThemeService(IPlatformServices platform)
foreach (var (name, value) in colors ?? new Dictionary<string, string>())
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;
}
/// <summary>Replaces (or, with no colours, removes) the user's colours for one variant.</summary>
diff --git a/src/Filee.App/Styles/Soft.axaml b/src/Filee.App/Styles/Soft.axaml
index 5a6269dd..d6b28b2c 100644
--- a/src/Filee.App/Styles/Soft.axaml
+++ b/src/Filee.App/Styles/Soft.axaml
@@ -27,6 +27,15 @@
<SolidColorBrush x:Key="AccentFaintBrush" Color="#177F77DD" />
<SolidColorBrush x:Key="AccentStrongBrush" Color="#5F59A6" />
<SolidColorBrush x:Key="OnAccentBrush" Color="#FFFFFF" />
+ <!-- Plain buttons: the surface with a thin border, so only a disabled control is a flat grey (#524).
+ ThemeService gives them a theme's own surface (Material You, theme.json). -->
+
+ <SolidColorBrush x:Key="ButtonBackground" Color="#FFFFFF" />
+ <SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#EFEDE6" />
+ <SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#E6E3DA" />
+ <SolidColorBrush x:Key="ButtonBorderBrush" Color="#29000000" />
+ <SolidColorBrush x:Key="ButtonBorderBrushPointerOver" Color="#3D000000" />
+ <SolidColorBrush x:Key="ButtonBorderBrushPressed" Color="#3D000000" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="PageBrush" Color="#1B1B19" />
@@ -44,6 +53,12 @@
<SolidColorBrush x:Key="AccentFaintBrush" Color="#177F77DD" />
<SolidColorBrush x:Key="AccentStrongBrush" Color="#5F59A6" />
<SolidColorBrush x:Key="OnAccentBrush" Color="#FFFFFF" />
+ <SolidColorBrush x:Key="ButtonBackground" Color="#262624" />
+ <SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#31312E" />
+ <SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#3A3A36" />
+ <SolidColorBrush x:Key="ButtonBorderBrush" Color="#38FFFFFF" />
+ <SolidColorBrush x:Key="ButtonBorderBrushPointerOver" Color="#4DFFFFFF" />
+ <SolidColorBrush x:Key="ButtonBorderBrushPressed" Color="#4DFFFFFF" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
diff --git a/tests/Filee.App.Tests/MaterialYouThemeTests.cs b/tests/Filee.App.Tests/MaterialYouThemeTests.cs
index 75a75c93..22aba023 100644
--- a/tests/Filee.App.Tests/MaterialYouThemeTests.cs
+++ b/tests/Filee.App.Tests/MaterialYouThemeTests.cs
@@ -198,6 +198,35 @@ public class MaterialYouThemeTests
var darkSurface = Assert.IsType<SolidColorBrush>(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<ThemeService>();
+ 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
{