Skip to content

Simple theme resources use DynamicResource to make tweaks easier#20819

Open
zacfromaustinpowder wants to merge 1 commit intoAvaloniaUI:masterfrom
zacfromaustinpowder:simpleThemeDynColors
Open

Simple theme resources use DynamicResource to make tweaks easier#20819
zacfromaustinpowder wants to merge 1 commit intoAvaloniaUI:masterfrom
zacfromaustinpowder:simpleThemeDynColors

Conversation

@zacfromaustinpowder
Copy link
Contributor

@zacfromaustinpowder zacfromaustinpowder commented Mar 6, 2026

What does the pull request do?

I wanted to make some tweaks to SimpleTheme. I could've done it by overriding the colors AND the brushes, but it would be much nicer to only worry about the colors. This is possible now that the brushes bind dynamically to the colors.

Checklist

Breaking changes

None. (EDIT: This may actually be a breaking change if people are doing something weird where they override the colors but not the brushes, or vice-versa).

Obsoletions / Deprecations

None.

Fixed issues

None (I think).

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0063052-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@robloo
Copy link
Contributor

robloo commented Mar 6, 2026

Colors are constants -- you modify the brushes instead. I wouldn't merge this.

@zacfromaustinpowder
Copy link
Contributor Author

Fluent theme seems to dynamically bind to the colors, I figured it would be nice to do the same with simple theme. I'm happy if it doesn't get merged though.

@robloo
Copy link
Contributor

robloo commented Mar 9, 2026

Fluent theme seems to dynamically bind to the colors, I figured it would be nice to do the same with simple theme. I'm happy if it doesn't get merged though.

OK, fair enough. I misread this thinking it was for Fluent theme and changing how it was designed to work. So my mistake.

@robloo
Copy link
Contributor

robloo commented Mar 9, 2026

Although, after reviewing Fluent theme I can see we are actually inconsistent. Several Colors for base brushes are in fact static. It seems certain colors that are expected to change -- such as accent color -- are dynamic though.

<SolidColorBrush x:Key="SystemControlDisabledListMediumBrush" Color="{StaticResource SystemListMediumColor}" />
<SolidColorBrush x:Key="SystemControlDisabledTransparentBrush" Color="Transparent" />
<SolidColorBrush x:Key="SystemControlFocusVisualPrimaryBrush" Color="{DynamicResource SystemBaseHighColor}" />
<SolidColorBrush x:Key="SystemControlFocusVisualSecondaryBrush" Color="{DynamicResource SystemAltMediumColor}" />
<SolidColorBrush x:Key="SystemControlRevealFocusVisualBrush" Color="{DynamicResource SystemAccentColor}" />
<SolidColorBrush x:Key="SystemControlForegroundAccentBrush" Color="{DynamicResource SystemAccentColor}" />
<SolidColorBrush x:Key="SystemControlForegroundAltHighBrush" Color="{StaticResource SystemAltHighColor}" />
<SolidColorBrush x:Key="SystemControlForegroundAltMediumHighBrush"
Color="{StaticResource SystemAltMediumHighColor}" />
<SolidColorBrush x:Key="SystemControlForegroundBaseHighBrush" Color="{StaticResource SystemBaseHighColor}" />
<SolidColorBrush x:Key="SystemControlForegroundBaseLowBrush" Color="{StaticResource SystemBaseLowColor}" />
<SolidColorBrush x:Key="SystemControlForegroundBaseMediumBrush" Color="{StaticResource SystemBaseMediumColor}" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants