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
Keep input and dropdown hover faint in dark Material You
adnan-bhaldar300cb5c2dda5
diff --git a/src/Filee.App/Services/MaterialYouPalette.cs b/src/Filee.App/Services/MaterialYouPalette.csindex 0579a5b3..5398dba2 100644--- a/src/Filee.App/Services/MaterialYouPalette.cs+++ b/src/Filee.App/Services/MaterialYouPalette.cs@@ -29,8 +29,10 @@ public sealed class MaterialYouPalettepublic required Color OnAccent { get; init; }/// <summary>Creates an Avalonia ResourceDictionary mapping standard Filee theme keys to solid brushes and resources.</summary>- public ResourceDictionary ToResourceDictionary() => new()+ public ResourceDictionary ToResourceDictionary(){+ var resources = new ResourceDictionary+ {["PageBrush"] = new SolidColorBrush(Page),["SurfaceBrush"] = new SolidColorBrush(Surface),["SurfaceAltBrush"] = new SolidColorBrush(SurfaceAlt),@@ -90,7 +92,26 @@ public sealed class MaterialYouPalette["TextControlButtonBorderBrushPressed"] = new SolidColorBrush(Colors.Transparent),["TextControlButtonForegroundPointerOver"] = new SolidColorBrush(Accent),["TextControlButtonForegroundPressed"] = new SolidColorBrush(Accent),- };+ };++ // 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.+ 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",+ "ComboBoxBackgroundPointerOver", "ComboBoxBackgroundPressed",+ })+ resources[key] = faint;+ }++ return resources;+ }/// <summary>True if the colour is monochrome (low saturation or black/white/charcoal).</summary>public static bool IsMonochrome(Color c)diff --git a/tests/Filee.App.Tests/MaterialYouThemeTests.cs b/tests/Filee.App.Tests/MaterialYouThemeTests.csindex 1be4efd9..a40e371d 100644--- a/tests/Filee.App.Tests/MaterialYouThemeTests.cs+++ b/tests/Filee.App.Tests/MaterialYouThemeTests.cs@@ -508,6 +508,32 @@ public class MaterialYouThemeTests}}+ [Fact]+ public void Dark_inputs_and_dropdowns_get_a_faint_hover_instead_of_near_black()+ {+ foreach (var seed in new[] { "#7F77DD", "#1D9E75", "#1F1E1D" })+ {+ var dark = MaterialYouPalette.Generate(Color.Parse(seed), isDark: true).ToResourceDictionary();++ foreach (var (rest, hover) in new[]+ {+ ("TextControlBackground", "TextControlBackgroundPointerOver"),+ ("TextControlBackground", "TextControlBackgroundFocused"),+ ("ComboBoxBackground", "ComboBoxBackgroundPointerOver"),+ })+ {+ 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}");+ }+ }+ }+private static Color ResolveColor(string key, ThemeVariant variant){var window = new Window();