Skip to content

Skills have no guidance for theme colours and breakpoints in Skia and custom controls #229

Open

Description

@noknowscode

The skills do not cover two cases where an app can drift away from the theme and the form factor: custom Skia drawing and custom controls that need breakpoints. As a result, agents hard-code colours in Skia renderers (SKColors.X, new SKColor(0x...), fixed palette arrays), so charts and canvases stay in one theme. They also compare ActualWidth in code to adapt the drawing. The skills should show how a Skia surface reads theme colours and redraws, and how custom controls get their breakpoints from {utu:Responsive}.

Where it happens

  • No skill under skills/ covers theme colours in SKCanvasElement or SKXamlCanvas drawing.
  • uno-toolkit/references/responsive.md covers {utu:Responsive} and ResponsiveView for standard XAML only, and says nothing about custom or Skia controls.

In the Studio sample apps we measured, the Skia charts, the heatmap and the 3D views carry most of the C# colour literals. One chart is fixed to dark mode.

Expected

Skia drawing reads the theme. A custom surface exposes one Brush dependency property per role it draws with, and the app binds each one with {ThemeResource}. The control converts the colour to an SKColor on the UI thread and calls Invalidate(). A ThemeResource binding re-resolves when the theme changes, so the drawing follows light, dark and palette edits without app wiring. Handling ActualThemeChanged covers the colours resolved some other way.

<local:HarbourCanvas AccentBrush="{ThemeResource PrimaryBrush}"
                     AlarmBrush="{ThemeResource ErrorBrush}"
                     GroundBrush="{ThemeResource SurfaceContainerHighBrush}" />

Series and ramps bind one brush per role and interpolate between two of them in code, with no fixed colour arrays.

Form factor for custom controls. Breakpoint decisions come in through properties bound with {utu:Responsive} on the Toolkit breakpoints:

<local:LiveChart Density="{utu:Responsive Narrow=Compact, Wide=Full}"
                 LegendPlacement="{utu:Responsive Narrow=Bottom, Wide=Right}" />

The control scales its geometry to the size it gets, but it never decides a breakpoint from ActualWidth.

Suggested changes

Open questions

  • Both patterns still need a run on Uno.Sdk 7 in a sample: the theme-change redraw, and {utu:Responsive} converting a string to an enum-typed custom property. We will report the results here.

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