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.

fix(ui): leave resting input fills alone in dark Material You

adnan-bhaldar26659fb35782
diff --git a/src/Filee.App/Services/MaterialYouPalette.cs b/src/Filee.App/Services/MaterialYouPalette.cs
index 5e793d49..94d1e427 100644
--- a/src/Filee.App/Services/MaterialYouPalette.cs
+++ b/src/Filee.App/Services/MaterialYouPalette.cs
@@ -95,13 +95,11 @@ public sealed class MaterialYouPalette
};
// Dark mode: Fluent's hover and focus fills for inputs and dropdowns are near-black, a sudden dark box. Keep them a
- // faint step lighter than the resting fill instead, so hovering only hints at the change.
+ // faint step lighter than the resting fill (SurfaceAlt, which the Material You styles already give inputs and
+ // dropdowns) instead, so hovering only hints at the change. The resting fills themselves are not set here.
if (Luminance(Surface) < 0.5)
{
- var rest = new SolidColorBrush(SurfaceAlt);
var faint = new SolidColorBrush(SoftPalette.Shade(SurfaceAlt, 0.06));
- foreach (var key in new[] { "TextControlBackground", "ComboBoxBackground", "ComboBoxBackgroundUnfocused" })
- resources[key] = rest;
foreach (var key in new[]
{
"TextControlBackgroundPointerOver", "TextControlBackgroundFocused",
diff --git a/tests/Filee.App.Tests/MaterialYouThemeTests.cs b/tests/Filee.App.Tests/MaterialYouThemeTests.cs
index fb0898a6..10101aa1 100644
--- a/tests/Filee.App.Tests/MaterialYouThemeTests.cs
+++ b/tests/Filee.App.Tests/MaterialYouThemeTests.cs
@@ -513,23 +513,26 @@ public class MaterialYouThemeTests
{
foreach (var seed in new[] { "#7F77DD", "#1D9E75", "#1F1E1D" })
{
- var dark = MaterialYouPalette.Generate(Color.Parse(seed), isDark: true).ToResourceDictionary();
+ var palette = MaterialYouPalette.Generate(Color.Parse(seed), isDark: true);
+ var dark = palette.ToResourceDictionary();
- foreach (var (rest, hover) in new[]
+ // Only hover and focus change: the resting fills are left to the Material You styles, as before.
+ foreach (var rest in new[] { "TextControlBackground", "ComboBoxBackground", "ComboBoxBackgroundUnfocused" })
+ Assert.False(dark.ContainsKey(rest), $"{seed}: {rest} is a resting fill and should not be set");
+
+ foreach (var hover in new[]
{
- ("TextControlBackground", "TextControlBackgroundPointerOver"),
- ("TextControlBackground", "TextControlBackgroundFocused"),
- ("ComboBoxBackground", "ComboBoxBackgroundPointerOver"),
+ "TextControlBackgroundPointerOver", "TextControlBackgroundFocused",
+ "ComboBoxBackgroundPointerOver", "ComboBoxBackgroundPressed",
})
{
- var restColor = Assert.IsType<SolidColorBrush>(dark[rest]).Color;
var hoverColor = Assert.IsType<SolidColorBrush>(dark[hover]).Color;
- // A step lighter than the resting fill, never darker than it.
- Assert.True(MaterialYouPalette.Luminance(hoverColor) > MaterialYouPalette.Luminance(restColor),
- $"{seed}: {hover} {hoverColor} should be slightly lighter than {rest} {restColor}");
- Assert.True(MaterialYouPalette.Luminance(hoverColor) - MaterialYouPalette.Luminance(restColor) < 0.12,
- $"{seed}: {hover} {hoverColor} should stay faint next to {rest} {restColor}");
+ // A step lighter than the resting fill (SurfaceAlt), never darker than it.
+ Assert.True(MaterialYouPalette.Luminance(hoverColor) > MaterialYouPalette.Luminance(palette.SurfaceAlt),
+ $"{seed}: {hover} {hoverColor} should be slightly lighter than {palette.SurfaceAlt}");
+ Assert.True(MaterialYouPalette.Luminance(hoverColor) - MaterialYouPalette.Luminance(palette.SurfaceAlt) < 0.12,
+ $"{seed}: {hover} {hoverColor} should stay faint next to {palette.SurfaceAlt}");
}
}
}