Skip to content

Commit

Permalink
Small bugfix in Accent Color determination making sure we end up with…
Browse files Browse the repository at this point in the history
… an accent color even on Windows 7.
  • Loading branch information
Dirkster99 committed Mar 10, 2018
1 parent eaec059 commit 57b7ead
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions source/Apps/ExplorerTestMLib/ViewModels/ThemeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,34 @@ public void ApplyTheme(FrameworkElement fe, string themeName)
}
}

/// <summary>
/// Gets the current accent color based on user preference (if any) or
/// based on Windows 10 settings (if we run on Windows 10), otherwise
/// Accent Color defaults to default blue'ish.
/// </summary>
/// <param name="settings"></param>
/// <returns></returns>
public static Color GetCurrentAccentColor(ISettingsManager settings)
{
Color AccentColor;
Color AccentColor = default(Color);

if (settings.Options.GetOptionValue<bool>("Appearance", "ApplyWindowsDefaultAccent"))
AccentColor = SystemParameters.WindowGlassColor;
{
try
{
AccentColor = SystemParameters.WindowGlassColor;
}
catch
{
}

// This may be black on Windows 7 and the experience is black & white then :-(
if (AccentColor == default(Color) || AccentColor == Colors.Black || AccentColor.A == 0)
{
// default blue accent color
AccentColor = Color.FromRgb(0x1b, 0xa1, 0xe2);
}
}
else
AccentColor = settings.Options.GetOptionValue<Color>("Appearance", "AccentColor");

Expand Down

0 comments on commit 57b7ead

Please sign in to comment.