Skip to content

Skills allow colour, spacing and radius literals outside the palette override, so apps ignore theme edits #228

Open

Description

@noknowscode

The skills only forbid colour literals in page XAML, so apps move their colours into their own token and palette files, and Studio's theme editor can no longer restyle them. The editor changes the palette override, and app-level brushes in App.xaml or Tokens.xaml sit on top of it, so any edit made in the editor never reaches the app. The skills should say that the palette override is the only place an app defines colours, and the review check should enforce that.

Where it happens

What we measured

Across nine Studio sample apps that followed the current guidance, we found 754 lines of hex colours in XAML and 73 colour literals in C#, all outside the palette override. Most sit in app files such as Tokens.xaml, Palette.xaml, StatusColors.xaml and in Skia renderers. Spacing and radius follow the same pattern: most apps define their own instead of using the Uno.Themes Space* and Radius* tokens that every control template already uses.

Expected

The skills teach one rule, with the goal that a sample works in any form factor and any theme with the least wiring:

  1. Colour. The only colours an app defines are in its palette override (ThemeColors OverrideSource / OverrideDictionary, or a seed). Everything else uses the semantic brushes: PrimaryBrush, OnSurfaceBrush, SurfaceContainerHighBrush, OutlineVariantBrush, ErrorBrush and the rest. The brand colour moves into the palette, so the app looks the same by default and follows any edit.
  2. Status and data colours (pass/watch/fail, alarms, chart series, map pins) map onto palette roles (Primary, Secondary, Tertiary, Error and their containers), so they follow the theme too. A suggested mapping: fail or alarm uses Error/ErrorContainer, watch uses Tertiary/TertiaryContainer, pass uses Primary or Secondary, and chart series use Primary, Secondary, Tertiary, Error, then their containers. Colour is never the only cue.
  3. Spacing, radius and type use the Uno.Themes tokens (Space*, Space*Thickness, Radius*CornerRadius) and the typography styles. Only layout limits that no theme has, such as a page's MaxWidth, stay local.
  4. Review gate: no hex, spacing or radius literal outside the palette override, in XAML or C#. This should be a scripted check that runs on every app, with a comment-based escape hatch that requires a reason.

Suggested changes

  • Rewrite the uno-themes rule at L35 to "no colour, spacing or radius literals anywhere except the palette override", covering resource dictionaries and C#.
  • Replace the "app's own brushes" sentence at L41 with the role mapping above.
  • Extend the L45 rule: app-level Space/Radius keys and token files are not allowed; set DefaultSpacing, DefaultCornerRadius and DefaultDensity on the theme instead.
  • Change the design.md check at L27 and L56 from "changed page XAML" to "every XAML and C# file except the palette override", and add spacing and radius literals to it.
  • Optionally ship the check as a script next to the skill (we have a working PowerShell lint for this and can contribute it).

Open question

Which file or property does Studio's theme editor write to on Uno.Themes 9 (OverrideSource, OverrideDictionary or seeds)? The rule should name that target exactly.

Activity

  1. added
    kind/consumer-experience
    on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/consumer-experiencetool/Uno Platform Skills

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions