Class FormPalette
The colours a form's SystemColor entries are drawn in.
public static class FormPalette
- Inheritance
-
FormPalette
- Inherited Members
Remarks
The light palette is Windows 11's default, as GetSysColor reads it with the default theme, on every platform, so a form
looks the same wherever it runs. GetSysColor gives the same colours in Windows' dark mode, so the dark palette is WinUI 3's
dark theme instead: each system colour is the colour of the resource that plays its part there, drawn over the dark background
where the resource is translucent. The accent, Highlight, is the same in both.
Methods
ToBrush(FormColor)
A brush that paints a form colour, with the light palette.
public static IBrush ToBrush(FormColor color)
Parameters
colorFormColorThe form colour.
Returns
- IBrush
A solid brush of ToColor(FormColor)'s colour.
ToBrush(FormColor, ThemeVariant?)
A brush that paints a form colour under a theme variant.
public static IBrush ToBrush(FormColor color, ThemeVariant? variant)
Parameters
colorFormColorThe form colour.
variantThemeVariantThe theme variant, as ToColor(FormColor, ThemeVariant?) reads it.
Returns
- IBrush
A solid brush of ToColor(FormColor, ThemeVariant?)'s colour.
ToColor(FormColor)
The colour a form colour is drawn in, with the light palette.
public static Color ToColor(FormColor color)
Parameters
colorFormColorThe form colour, an RGB colour or a system colour.
Returns
- Color
The colour, opaque.
ToColor(FormColor, ThemeVariant?)
The colour a form colour is drawn in under a theme variant.
public static Color ToColor(FormColor color, ThemeVariant? variant)
Parameters
colorFormColorThe form colour, an RGB colour or a system colour.
variantThemeVariantThe theme variant. Avalonia.Styling.ThemeVariant.Dark, or a variant that inherits it, draws a system colour in the dark palette, the colours of Windows' dark theme as WinUI 3 gives them; any other variant, or none, draws it in the light palette.
Returns
- Color
The colour, opaque. An RGB colour is the same under every variant.