Skip to content

Theme Configuration ​

All configuration lives on the MaterialTheme instance in Application.Styles. Every property is a StyledProperty and can be changed at runtime — the whole color scheme rebuilds instantly.

Properties ​

PropertyTypeDefaultDescription
SeedColorColor#6750A4Source color the entire palette is derived from
SchemeVariantSchemeVariantTonalSpotPalette recipe (see below)
ContrastLeveldouble0.00 standard · 0.5 medium · 1.0 high contrast
xml
<m3:MaterialTheme SeedColor="#006A6A"
                  SchemeVariant="Vibrant"
                  ContrastLevel="0.5" />

Runtime switching ​

Grab the theme instance and set properties — no restart needed:

csharp
using Material3.Avalonia;
using Material3.Avalonia.Colors;

var theme = Application.Current!.Styles.OfType<MaterialTheme>().First();

theme.SeedColor     = Colors.Teal;              // re-derives everything
theme.SchemeVariant = SchemeVariant.Expressive;
theme.ContrastLevel = 1.0;

Scheme variants ​

Material3.Avalonia.Colors.SchemeVariant — the same nine variants as Android / Material Color Utilities:

VariantCharacter
TonalSpotDefault. Balanced, muted chroma (Android 12+ default)
NeutralNear-grayscale with a hint of the seed
VibrantMaximum chroma, colorful secondaries
ExpressivePlayful hue rotations, unexpected accents
FidelityStays faithful to the exact seed color
ContentLike Fidelity, tuned for content-sourced seeds (album art…)
MonochromePure grayscale
RainbowColorful primary, neutral surfaces
FruitSaladShifted-hue primary/secondary pairing

What the theme injects ​

For each of the 45 M3 color roles the theme writes two resources per theme variant:

  • Md3{Role} — Color
  • Md3{Role}Brush — SolidColorBrush (mutated in place on rebuild)

Roles: Primary, OnPrimary, PrimaryContainer, OnPrimaryContainer, Secondary…, Tertiary…, Error…, Surface, SurfaceDim, SurfaceBright, SurfaceContainerLowest/Low/­/High/Highest, OnSurface, OnSurfaceVariant, Outline, OutlineVariant, Shadow, Scrim, SurfaceTint, InverseSurface, InverseOnSurface, InversePrimary, and the Fixed family (PrimaryFixed, PrimaryFixedDim, OnPrimaryFixed, OnPrimaryFixedVariant, same for Secondary/Tertiary).

xml
<Border Background="{DynamicResource Md3SurfaceContainerBrush}">
    <TextBlock Foreground="{DynamicResource Md3OnSurfaceBrush}" />
</Border>

Reserved properties

MotionScheme, ReduceMotion and Density exist on MaterialTheme but are not consumed by the theme yet — they are reserved for a future release.