Derive header action button colors from dynamic header color

This commit is contained in:
Meik
2026-03-05 12:17:42 +01:00
parent f9ab560a80
commit 2e53ede66b
4 changed files with 16 additions and 2 deletions

View File

@@ -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