Derive header action button colors from dynamic header color
This commit is contained in:
@@ -253,6 +253,16 @@ namespace C4IT_CustomerPanel.libs
|
||||
Application.Current.Resources["navigationRailBorderColor"] = new SolidColorBrush(navBorder);
|
||||
}
|
||||
|
||||
private static void ApplyHeaderDerivedResources(Color headerColor)
|
||||
{
|
||||
bool isLightHeader = GetRelativeLuminance(headerColor) >= 0.55;
|
||||
Color controlBase = BlendColor(headerColor, isLightHeader ? Colors.Black : Colors.White, isLightHeader ? 0.14 : 0.18);
|
||||
Color controlHover = BlendColor(headerColor, isLightHeader ? Colors.Black : Colors.White, isLightHeader ? 0.22 : 0.26);
|
||||
|
||||
Application.Current.Resources["headerControlBackgroundColor"] = new SolidColorBrush(controlBase);
|
||||
Application.Current.Resources["headerControlHoverBackgroundColor"] = new SolidColorBrush(controlHover);
|
||||
}
|
||||
|
||||
public SolidColorBrush GetHeaderColor()
|
||||
{
|
||||
return (SolidColorBrush)System.Windows.Application.Current.Resources["headerColor"];
|
||||
@@ -995,6 +1005,7 @@ namespace C4IT_CustomerPanel.libs
|
||||
|
||||
System.Windows.Application.Current.Resources["headerColor"] = new SolidColorBrush(headerColor);
|
||||
ApplyBackgroundDerivedResources(backgroundColor);
|
||||
ApplyHeaderDerivedResources(headerColor);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -1008,6 +1019,7 @@ namespace C4IT_CustomerPanel.libs
|
||||
|
||||
System.Windows.Application.Current.Resources["headerColor"] = new SolidColorBrush(fallbackHeader);
|
||||
ApplyBackgroundDerivedResources(fallbackBackground);
|
||||
ApplyHeaderDerivedResources(fallbackHeader);
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user