ApplicationAccentColorManager
- Assembly:
Fluence.Wpf - Namespace:
Fluence.Wpf
public static class ApplicationAccentColorManager
Manages system and custom accent colors and publishes them as DynamicResource brush keys aligned with Windows 11.
Remarks: Apply uses the Windows accent palette by default. Call ApplyCustomAccent to pin a custom ramp seed, ApplyCustomAccent with exact: true for an exact visible light-theme primary, or ApplySystemAccent to return to the Windows palette.
Example
ApplicationThemeManager.Apply(ApplicationTheme.Auto, WindowBackdropType.Mica);
ApplicationAccentColorManager.ApplyCustomAccent(System.Windows.Media.Colors.CornflowerBlue);
Properties
IsAccentColorOnTitleBarsEnabled
public static bool IsAccentColorOnTitleBarsEnabled { get; }
Gets a value indicating whether Windows is configured to show accent color on title bars and window borders.
SystemAccentColor
public static Color SystemAccentColor { get; }
Gets the current base accent color (ARGB). A theme apply loads the Windows accent palette by default; before the first apply, this returns the fallback blue.
SystemAccentColorDark1
public static Color SystemAccentColorDark1 { get; }
Gets the first dark shade on the resolved accent ramp.
SystemAccentColorDark2
public static Color SystemAccentColorDark2 { get; }
Gets the second dark shade on the resolved accent ramp.
SystemAccentColorDark3
public static Color SystemAccentColorDark3 { get; }
Gets the darkest shade on the resolved accent ramp.
SystemAccentColorLight1
public static Color SystemAccentColorLight1 { get; }
Gets the first light tint on the resolved accent ramp. Default matches SystemAccentColor until the ramp is loaded.
SystemAccentColorLight2
public static Color SystemAccentColorLight2 { get; }
Gets the second light tint on the resolved accent ramp.
SystemAccentColorLight3
public static Color SystemAccentColorLight3 { get; }
Gets the lightest tint on the resolved accent ramp.
SystemAccentColorPrimary
public static Color SystemAccentColorPrimary { get; }
Gets the primary accent color used for emphasis surfaces.
SystemAccentColorSecondary
public static Color SystemAccentColorSecondary { get; }
Gets the secondary accent color used for layered emphasis.
SystemAccentColorTertiary
public static Color SystemAccentColorTertiary { get; }
Gets the tertiary accent color used for subtle accent fills.
TitleBarActiveColor
public static Color TitleBarActiveColor { get; }
Gets the active titlebar color (from DWM AccentColor or default gray).
TitleBarInactiveColor
public static Color TitleBarInactiveColor { get; }
Gets the inactive titlebar color (from DWM AccentColorInactive or default gray).
WindowBorderColor
public static Color WindowBorderColor { get; }
Gets the window border color (titlebar active on Win11, blended on Win10).
Methods
ApplyCustomAccent
public static void ApplyCustomAccent(Color color, bool exact = false)
Applies a custom accent and republishes theme resources. By default the color is a ramp seed. With exact enabled, it is the visible light-theme primary; the dark-theme primary still comes from the resolved ramp's Light2 shade.
Parameter color: The accent seed, or the exact light-theme primary.
Parameter exact: Whether to use color as the visible light-theme primary.
ApplyCustomAccent
public static void ApplyCustomAccent(Color lightThemeAccent, Color darkThemeAccent, bool exact = false)
Applies per-theme custom accents and republishes theme resources. By default both colors are ramp seeds. With exact enabled, they are the visible primary colors in light and dark themes respectively.
Parameter lightThemeAccent: The light-theme seed or exact primary.
Parameter darkThemeAccent: The dark-theme seed or exact primary, and the high-contrast ramp seed.
Parameter exact: Whether to use the supplied colors as visible light- and dark-theme primaries.
ApplyCustomAccent
public static void ApplyCustomAccent(Color lightThemeAccent, Color darkThemeAccent)
Applies per-theme custom accent seeds and republishes theme resources. A seed matching the active Windows accent captures its seven-rung palette; other seeds use generated ramps. The selected palette stays pinned across later theme changes.
Parameter lightThemeAccent: The ramp seed used on the light theme.
Parameter darkThemeAccent: The ramp seed used on dark and high-contrast themes.
ApplyCustomAccent
public static void ApplyCustomAccent(Color color)
Applies a custom accent seed and republishes theme resources. When the seed matches the active Windows accent, its seven-rung palette is captured; otherwise a ramp is generated.
Parameter color: The accent color to use as the ramp base.
ApplyCustomAccentExact
public static void ApplyCustomAccentExact(Color lightThemeAccent, Color darkThemeAccent)
Applies exact visible primary accents on light and dark themes. The intent follows subsequent theme changes. High contrast retains its system state colors and uses the dark-theme color as its raw ramp seed.
Parameter lightThemeAccent: The exact primary accent color on the light theme.
Parameter darkThemeAccent: The exact primary accent color on the dark theme.
ApplyCustomAccentExact
public static void ApplyCustomAccentExact(Color lightThemeAccent)
Applies an exact visible primary accent on the light theme. The dark-theme primary is derived from the resolved ramp, and the intent follows subsequent theme changes. High contrast retains its system state colors and uses this color as its raw ramp seed.
Parameter lightThemeAccent: The exact primary accent color on the light theme.
ApplySystemAccent
public static void ApplySystemAccent()
Sets the accent intent to the live Windows accent palette and re-applies the current theme.
Events
AccentColorChanged
public static event EventHandler<EventArgs>? AccentColorChanged
Occurs after the theme engine publishes application resources, whether the publish follows a theme apply or an accent apply. A redundant apply raises no event.