diff --git a/src/Avalonia.Base/Platform/PlatformColorValues.cs b/src/Avalonia.Base/Platform/PlatformColorValues.cs
index b328e1304b..d14b58e939 100644
--- a/src/Avalonia.Base/Platform/PlatformColorValues.cs
+++ b/src/Avalonia.Base/Platform/PlatformColorValues.cs
@@ -61,37 +61,6 @@ public record PlatformColorValues
init => _accentColor3 = value;
}
- ///
- /// Dark shade 1 of , when the platform provides one (Windows does).
- /// Null when the platform only reports the base accent color; consumers are expected to compute a shade instead.
- ///
- public Color? AccentColorDark1 { get; init; }
-
- ///
- /// Dark shade 2 of , when the platform provides one. See .
- ///
- public Color? AccentColorDark2 { get; init; }
-
- ///
- /// Dark shade 3 of , when the platform provides one. See .
- ///
- public Color? AccentColorDark3 { get; init; }
-
- ///
- /// Light shade 1 of , when the platform provides one. See .
- ///
- public Color? AccentColorLight1 { get; init; }
-
- ///
- /// Light shade 2 of , when the platform provides one. See .
- ///
- public Color? AccentColorLight2 { get; init; }
-
- ///
- /// Light shade 3 of , when the platform provides one. See .
- ///
- public Color? AccentColorLight3 { get; init; }
-
public PlatformColorValues()
{
AccentColor1 = DefaultAccent;
diff --git a/src/Avalonia.Themes.Fluent2/Accents/SystemAccentColors.cs b/src/Avalonia.Themes.Fluent2/Accents/SystemAccentColors.cs
index 5cbee992c1..5d6749f9cd 100644
--- a/src/Avalonia.Themes.Fluent2/Accents/SystemAccentColors.cs
+++ b/src/Avalonia.Themes.Fluent2/Accents/SystemAccentColors.cs
@@ -20,8 +20,7 @@ internal sealed class SystemAccentColors : ResourceProvider
private static readonly Color s_defaultSystemAccentColor = Color.FromRgb(0, 120, 215);
// Static shade values from WinUI (matching the Uno/WinUI SystemResources defaults). Used when
// the platform provides no accent color, so the out-of-the-box palette matches WinUI exactly.
- // When the platform reports the OS-computed shades (Windows does, via UISettings) those are
- // used verbatim; otherwise an OS-provided base accent gets HSL-computed shades.
+ // OS-provided accent colors get computed shades instead.
private static readonly Color s_defaultSystemAccentColorDark1 = Color.FromUInt32(0xFF005A9E);
private static readonly Color s_defaultSystemAccentColorDark2 = Color.FromUInt32(0xFF004275);
private static readonly Color s_defaultSystemAccentColorDark3 = Color.FromUInt32(0xFF002642);
@@ -118,22 +117,11 @@ internal sealed class SystemAccentColors : ResourceProvider
{
_invalidateColors = false;
- var colorValues = GetFromOwner(Owner)?.GetColorValues();
+ var platformSettings = GetFromOwner(Owner);
- _systemAccentColor = colorValues?.AccentColor1 ?? s_defaultSystemAccentColor;
+ _systemAccentColor = platformSettings?.GetColorValues().AccentColor1 ?? s_defaultSystemAccentColor;
- if (colorValues is
- {
- AccentColorDark1: { } dark1, AccentColorDark2: { } dark2, AccentColorDark3: { } dark3,
- AccentColorLight1: { } light1, AccentColorLight2: { } light2, AccentColorLight3: { } light3
- })
- {
- // The platform reported the OS-computed shades (Windows, via UISettings);
- // use them verbatim so the palette matches the OS exactly.
- (_systemAccentColorDark1, _systemAccentColorDark2, _systemAccentColorDark3) = (dark1, dark2, dark3);
- (_systemAccentColorLight1, _systemAccentColorLight2, _systemAccentColorLight3) = (light1, light2, light3);
- }
- else if (_systemAccentColor == s_defaultSystemAccentColor)
+ if (_systemAccentColor == s_defaultSystemAccentColor)
{
// Platforms without a real accent color report the default; use WinUI's static
// shade values so the out-of-the-box palette matches WinUI exactly.
diff --git a/src/Avalonia.Themes.Fluent2/README.md b/src/Avalonia.Themes.Fluent2/README.md
index 93e34aeb68..8b25bb9f42 100644
--- a/src/Avalonia.Themes.Fluent2/README.md
+++ b/src/Avalonia.Themes.Fluent2/README.md
@@ -47,7 +47,6 @@ Migrating from `Avalonia.Themes.Fluent`: change the package reference and swap
| Scroll bars | 16 px rail | **12 px rail, 2 px collapsed thumb** |
| Window background | AltHigh | **SolidBackgroundFillColorBase** (#F3F3F3/#202020) |
| Default accent shades | HSL-computed | **WinUI static values** (when no OS accent) |
-| OS accent shades (Windows) | HSL-computed | **read from the OS** (`UISettings` Light1–3/Dark1–3) |
One deliberate deviation from WinUI (following FluentAvalonia's lead): CheckBox
and RadioButton do **not** get WinUI's forced 120 px `MinWidth` — they size to
@@ -80,10 +79,8 @@ English-only for now.
- No HighContrast variant yet (same as v1).
- AnimatedIcon glyph animations are approximated with static glyphs and simple
transitions.
-- On Windows the six accent shades (`SystemAccentColorDark1`…`Light3`) come
- straight from the OS; on platforms that report only a base accent color
- (macOS, Linux) the shades are HSL-computed and can deviate slightly from
- Windows' palette algorithm.
+- OS-provided accent colors still use HSL-computed shades, which can deviate
+ slightly from Windows' palette algorithm.
## Compatibility tests
diff --git a/src/Windows/Avalonia.Win32/Win32PlatformSettings.cs b/src/Windows/Avalonia.Win32/Win32PlatformSettings.cs
index cf244c9400..3be3d4876a 100644
--- a/src/Windows/Avalonia.Win32/Win32PlatformSettings.cs
+++ b/src/Windows/Avalonia.Win32/Win32PlatformSettings.cs
@@ -86,13 +86,7 @@ internal class Win32PlatformSettings : DefaultPlatformSettings
PlatformThemeVariant.Dark :
PlatformThemeVariant.Light,
ContrastPreference = ColorContrastPreference.NoPreference,
- AccentColor1 = accent,
- AccentColorDark1 = uiSettings.GetColorValue(UIColorType.AccentDark1).ToAvalonia(),
- AccentColorDark2 = uiSettings.GetColorValue(UIColorType.AccentDark2).ToAvalonia(),
- AccentColorDark3 = uiSettings.GetColorValue(UIColorType.AccentDark3).ToAvalonia(),
- AccentColorLight1 = uiSettings.GetColorValue(UIColorType.AccentLight1).ToAvalonia(),
- AccentColorLight2 = uiSettings.GetColorValue(UIColorType.AccentLight2).ToAvalonia(),
- AccentColorLight3 = uiSettings.GetColorValue(UIColorType.AccentLight3).ToAvalonia()
+ AccentColor1 = accent
};
}
}
diff --git a/tests/Avalonia.Themes.Fluent2.UnitTests/PaletteTests.cs b/tests/Avalonia.Themes.Fluent2.UnitTests/PaletteTests.cs
index 27d04d2cae..1acfdc0a29 100644
--- a/tests/Avalonia.Themes.Fluent2.UnitTests/PaletteTests.cs
+++ b/tests/Avalonia.Themes.Fluent2.UnitTests/PaletteTests.cs
@@ -1,6 +1,5 @@
using Avalonia.Controls;
using Avalonia.Media;
-using Avalonia.Platform;
using Avalonia.Styling;
namespace Avalonia.Themes.Fluent2.UnitTests;
@@ -66,48 +65,6 @@ public class PaletteTests
}
}
- [AvaloniaFact]
- public void Platform_provided_accent_shades_take_precedence_over_computed_ones()
- {
- var originalSettings = AvaloniaLocator.Current.GetService();
- Assert.NotNull(originalSettings);
- AvaloniaLocator.CurrentMutable.Bind().ToConstant(new ShadeReportingPlatformSettings());
-
- var theme = new Fluent2Theme();
- var app = Application.Current!;
- app.Styles.Add(theme);
- try
- {
- Assert.True(app.TryGetResource("SystemAccentColor", ThemeVariant.Light, out var accent));
- Assert.Equal(Colors.Crimson, Assert.IsType(accent));
-
- // The OS-reported shades are used verbatim, not HSL-computed from the base color.
- Assert.True(app.TryGetResource("SystemAccentColorDark1", ThemeVariant.Light, out var dark1));
- Assert.Equal(Colors.DarkRed, Assert.IsType(dark1));
- Assert.True(app.TryGetResource("SystemAccentColorLight3", ThemeVariant.Light, out var light3));
- Assert.Equal(Colors.MistyRose, Assert.IsType(light3));
- }
- finally
- {
- app.Styles.Remove(theme);
- AvaloniaLocator.CurrentMutable.Bind().ToConstant(originalSettings);
- }
- }
-
- private sealed class ShadeReportingPlatformSettings : DefaultPlatformSettings
- {
- public override PlatformColorValues GetColorValues() => new()
- {
- AccentColor1 = Colors.Crimson,
- AccentColorDark1 = Colors.DarkRed,
- AccentColorDark2 = Colors.Maroon,
- AccentColorDark3 = Colors.Brown,
- AccentColorLight1 = Colors.Salmon,
- AccentColorLight2 = Colors.LightSalmon,
- AccentColorLight3 = Colors.MistyRose,
- };
- }
-
[AvaloniaFact]
public void Legacy_palette_colors_derive_fluent2_tokens()
{