development-plugin-for-avalonia

Color, Surfaces, Elevation, and Material Depth in Avalonia

Table of Contents

  1. Scope and Primary APIs
  2. Surface Strategy
  3. Elevation Rules
  4. Material Guidance
  5. AOT and Performance Notes
  6. Do and Don’t Guidance
  7. Troubleshooting
  8. Official Resources

Scope and Primary APIs

Use this reference for polished surface treatment and depth decisions.

Primary APIs:

Surface Strategy

Use semantic roles:

Card example:

<Border xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Classes="metric-card"
        Padding="16">
  <StackPanel Spacing="8">
    <TextBlock Classes="eyebrow" Text="Revenue" />
    <TextBlock Classes="title" Text="$420,000" />
  </StackPanel>
</Border>
<Style Selector="Border.metric-card">
  <Setter Property="Background" Value="{DynamicResource Brush.Surface.Card}" />
  <Setter Property="BorderBrush" Value="{DynamicResource Brush.Border.Subtle}" />
  <Setter Property="BorderThickness" Value="1" />
  <Setter Property="CornerRadius" Value="12" />
  <Setter Property="BoxShadow" Value="0 8 24 0 #18000000" />
</Style>

Elevation Rules

Material Guidance

Use acrylic sparingly and only where a translucent surface adds context.

<ExperimentalAcrylicBorder xmlns="https://github.com/avaloniaui"
                           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                           CornerRadius="12">
  <ExperimentalAcrylicBorder.Material>
    <ExperimentalAcrylicMaterial TintColor="#FF20242B"
                                 TintOpacity="0.8"
                                 MaterialOpacity="0.45"
                                 FallbackColor="#CC20242B" />
  </ExperimentalAcrylicBorder.Material>
  <Border Padding="16">
    <TextBlock Text="Use acrylic for accent surfaces, not every surface." />
  </Border>
</ExperimentalAcrylicBorder>

AOT and Performance Notes

Do and Don’t Guidance

Do:

Do not:

Troubleshooting

  1. Surfaces feel noisy.
    • Reduce shadow depth, simplify border colors, and narrow the accent palette.
  2. Dark theme feels muddy.
    • Increase edge contrast and reduce translucent layering.
  3. Acrylic becomes unreadable.
    • Strengthen fallback color and keep text on stable inner surfaces.

Official Resources