Skip to content

ApplicationAccentColorManager has different logic than Accent.xaml #1481

@labsin

Description

@labsin

Describe the bug

In ApplicationAccentColorManager, the colors are set using this logic:

        UiApplication.Current.Resources["SystemAccentColor"] = systemAccent;
        UiApplication.Current.Resources["SystemAccentColorPrimary"] = primaryAccent;
        UiApplication.Current.Resources["SystemAccentColorSecondary"] = secondaryAccent;
        UiApplication.Current.Resources["SystemAccentColorTertiary"] = tertiaryAccent;

        UiApplication.Current.Resources["SystemAccentBrush"] = secondaryAccent.ToBrush();
        UiApplication.Current.Resources["SystemFillColorAttentionBrush"] = secondaryAccent.ToBrush();
        UiApplication.Current.Resources["AccentTextFillColorPrimaryBrush"] = tertiaryAccent.ToBrush();
        UiApplication.Current.Resources["AccentTextFillColorSecondaryBrush"] = tertiaryAccent.ToBrush();
        UiApplication.Current.Resources["AccentTextFillColorTertiaryBrush"] = secondaryAccent.ToBrush();
        UiApplication.Current.Resources["AccentFillColorSelectedTextBackgroundBrush"] =
            systemAccent.ToBrush();
        UiApplication.Current.Resources["AccentFillColorDefaultBrush"] = secondaryAccent.ToBrush();

        UiApplication.Current.Resources["AccentFillColorSecondaryBrush"] = secondaryAccent.ToBrush(0.9);
        UiApplication.Current.Resources["AccentFillColorTertiaryBrush"] = secondaryAccent.ToBrush(0.8);

Now looking at Accent.xaml, the defaults are set using:

    <!--  Colors depending on the theme should be changed by the Manager  -->
    <Color x:Key="SystemAccentColor">#3379d9</Color>

    <!--  While the name remains Light to stay with the official nomenclature, it's made dark in Dark Theme  -->

    <!--  SystemAccentColorDark1 | SystemAccentColorLight1  -->
    <Color x:Key="SystemAccentColorPrimary">#559ce4</Color>
    <!--  SystemAccentColorDark2 | SystemAccentColorLight2  -->
    <Color x:Key="SystemAccentColorSecondary">#80b9ee</Color>
    <!--  SystemAccentColorDark3 | SystemAccentColorLight3  -->
    <Color x:Key="SystemAccentColorTertiary">#add8ff</Color>

    <SolidColorBrush x:Key="SystemAccentColorBrush" Color="{StaticResource SystemAccentColor}" />

    <SolidColorBrush x:Key="SystemAccentColorPrimaryBrush" Color="{StaticResource SystemAccentColorPrimary}" />
    <SolidColorBrush x:Key="SystemAccentColorSecondaryBrush" Color="{StaticResource SystemAccentColorSecondary}" />
    <SolidColorBrush x:Key="SystemAccentColorTertiaryBrush" Color="{StaticResource SystemAccentColorTertiary}" />

    <SolidColorBrush x:Key="AccentTextFillColorPrimaryBrush" Color="{StaticResource SystemAccentColorSecondary}" />
    <SolidColorBrush x:Key="AccentTextFillColorSecondaryBrush" Color="{StaticResource SystemAccentColorTertiary}" />
    <SolidColorBrush x:Key="AccentTextFillColorTertiaryBrush" Color="{StaticResource SystemAccentColorPrimary}" />

    <SolidColorBrush x:Key="AccentFillColorSelectedTextBackgroundBrush" Color="{StaticResource SystemAccentColor}" />

    <SolidColorBrush x:Key="AccentFillColorDefaultBrush" Color="{StaticResource SystemAccentColorPrimary}" />
    <SolidColorBrush
        x:Key="AccentFillColorSecondaryBrush"
        Opacity="0.9"
        Color="{StaticResource SystemAccentColorPrimary}" />
    <SolidColorBrush
        x:Key="AccentFillColorTertiaryBrush"
        Opacity="0.8"
        Color="{StaticResource SystemAccentColorPrimary}" />
    <SolidColorBrush x:Key="AccentFillColorDisabledBrush" Color="{StaticResource AccentFillColorDisabled}" />


    <SolidColorBrush x:Key="SystemFillColorAttentionBrush" Color="{StaticResource SystemAccentColor}" />

SystemAccentBrush is set to secondaryAccent, which is weird and different than the SystemAccentBrush property on ApplicationAccentColorManager

A lot of the other brushes have completely different logic.

To Reproduce

  • Look at brushes with default accenst
  • Call ApplicationAccentColorManager.Apply with system color of 3379d9 (default)
  • See that the brushes are different

Expected behavior

Have (more or less) the same accent colors after as the default

Screenshots

No response

OS version

Windows 10

.NET version

.net 8

WPF-UI NuGet version

4.0.3

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions