Skip to content

Skills teach a new brush where a lightweight styling override should alias an existing one #236

Closed

Description

@kazo0

What happens
The skills show one way to override a lightweight styling key: define a new brush.

<SolidColorBrush x:Key="FilledButtonBackground" Color="#006D3B" />

An agent that follows them writes a new brush for every key it overrides, even when the value is a brush the theme already has. In one generated app, 15 tab bar and chip keys were each written as <SolidColorBrush x:Key="ChipBackgroundChecked" Color="{ThemeResource PrimaryColor}" />, once in Light and again, identically, in Default.

What should happen
When the new value is an existing resource, the override is an alias, written once:

<StaticResource x:Key="ChipBackgroundChecked" ResourceKey="PrimaryBrush" />

A new SolidColorBrush, with Light and Default values, is only for a colour the palette does not have.

This applies to every lightweight styling key: WinUI, Uno Themes (Material and Simple) and Uno Toolkit controls, on semantic and non-semantic styles alike.

Proposed changes (under plugins/uno-platform-studio/skills/, then the skills/ mirror)

  • uno-themes/references/semantic-colors-brushes.md, Part 4
    • "Method 2: Override Specific Brushes (Targeted)": state the rule above and show the alias first. Keep the SolidColorBrush example for a colour outside the palette.
    • "Method 3: Override Per-Control Instance (Scoped)": same rule for the scoped case.
  • uno-themes/references/simple.md, Customization Methods, item 3: replace the SolidColorBrush one-liner with the alias, or point to Part 4.
  • uno-themes/references/material-customization.md, Customization, item 2: same.
  • uno-themes/SKILL.md, "Restyle through resource keys, not copied templates": add one sentence with the rule, since this is the line an agent reads before any reference.
  • uno-toolkit/references/lightweight-styling.md, Key Principles: one line pointing to the rule in uno-themes. It has no XAML example today.
  • evals/uno-themes: a case that overrides a lightweight key to a theme brush, with a grader that fails on a new SolidColorBrush for it.

Notes

  • The skills already say this for app-named brushes ("use a role through its brush"); it is not carried through to lightweight keys.
  • Not yet checked: that an alias placed at app scope follows a Light/Dark switch and a Hot Reload update in a running app. Worth one check before the wording lands.

Activity

  1. added
    triage/untriaged
    on Nov 14, 2026
  2. self-assigned this
    on Nov 14, 2026
  3. kazo0 commented on Nov 14, 2026

    @kazo0
    ContributorAuthor

    Two more rules, from the next generated app

    With the alias rule in place, the next app wrote 27 alias overrides. 15 of them change nothing on screen:

    • 14 restate the default. For example, <StaticResource x:Key="OutlinedButtonBorderBrush" ResourceKey="OutlineBrush" />: Simple already resolves that key to OutlineBrush, through FilledTonalButtonBorderBrush. The same goes for FilledButtonBackground, TextButtonForeground, ChipBackgroundChecked, ChipBorderBrush, DividerForeground, BottomTabBarBackground and others.
    • 3 target the wrong control. The app uses utu:CardContentControl, but it overrode FilledCardBackground, OutlinedCardBorderBrush and CardForeground. Only utu:Card reads those keys.

    The example in this issue's description has the same problem: ChipBackgroundChecked → PrimaryBrush is already Simple's default.

    Rules to add next to the alias rule

    1. Override a key only to change it. A key set to the brush the theme already gives it does nothing.
    2. Override the keys of the control the page uses. A utu:CardContentControl reads the *CardContent* keys, not the *Card* ones.

    What the skills need for rule 1

    An agent can follow rule 1 only if it knows each key's default. Where a reference lists keys, give each one's default for Simple and for Material. Pick an example key whose default differs from the override, such as TabBarItemForegroundSelected → PrimaryBrush (the Simple default is OnSurfaceBrush).

    Simple cards

    Source: Uno.Toolkit.Simple/Styles/Controls/CardContentControl.xaml.

    • All three card styles read the same keys.
    • FilledCardContentBackground is the background of every card.
    • OutlinedCardContentBorderBrush is the border of both Outlined and Elevated.
    • OutlinedCardContentBackground and the Elevated* keys are defined but never read.
    • Card text uses OnSurfaceBrush directly; no key controls it.

    This is worth a line in uno-toolkit/references/card.md. Today the skills say to copy keys from the control's doc table, and that leads to overrides with no effect.

  4. added a commit that references this issue on Nov 15, 2026
    0f73a6a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

tool/Uno Platform Skillstriage/untriaged

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions