Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/Wpf.Ui/Appearance/ApplicationAccentColorManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
/// <summary>
/// The maximum value of the background HSV brightness after which the text on the accent will be turned dark.
/// </summary>
private const double BackgroundBrightnessThresholdValue = 80d;

Check warning on line 55 in src/Wpf.Ui/Appearance/ApplicationAccentColorManager.cs

View workflow job for this annotation

GitHub Actions / build


/// <summary>
/// Gets the SystemAccentColor.
Expand Down Expand Up @@ -158,10 +158,12 @@
/// <param name="systemAccent">Primary accent color.</param>
/// <param name="applicationTheme">If <see cref="ApplicationTheme.Dark"/>, the colors will be different.</param>
/// <param name="systemGlassColor">If the color is taken from the Glass Color System, its brightness will be increased with the help of the operations on HSV space.</param>
/// <param name="systemAccentColor">If the color is the system accent color.</param>
public static void Apply(
Color systemAccent,
ApplicationTheme applicationTheme = ApplicationTheme.Light,
bool systemGlassColor = false
bool systemGlassColor = false,
bool systemAccentColor = false
)
{
if (systemGlassColor)
Expand All @@ -170,7 +172,6 @@
systemAccent = systemAccent.UpdateBrightness(6f);
}

bool isSystemAccent = systemAccent == GetColorizationColor();
Color primaryAccent;
Color secondaryAccent;
Color tertiaryAccent;
Expand All @@ -192,7 +193,7 @@

Color GetColor(UIColorType colorType, float brightnessFactor, float saturationFactor = 0.0f)
{
if (isSystemAccent && GetUiColor(colorType) is { } color)
if (systemAccentColor && GetUiColor(colorType) is { } color)
{
return color;
}
Expand Down Expand Up @@ -229,7 +230,7 @@
/// </summary>
public static void ApplySystemAccent()
{
Apply(GetColorizationColor(), ApplicationThemeManager.GetAppTheme());
Apply(GetColorizationColor(), ApplicationThemeManager.GetAppTheme(), systemAccentColor: true);
}

/// <summary>
Expand Down
Loading