How To Use Theme Variants
Because theme variants are deeply integrated into resources system, it is important to understand the Avalonia resources first.
Introduction
In Avalonia, a theme variant
refers to a specific visual appearance of control based on a chosen theme.
By using theme variants, developers can create visually appealing and consistent user interfaces that adapt to different user preferences or system settings. For example, an application may provide a light theme variant with a white background and black text, as well as a dark theme variant with a black background and white text. The user can choose their preferred theme, and the application will adjust its appearance accordingly.
Avalonia's built-in themes, SimpleTheme
and FluentTheme
, seamlessly support Dark
and Light
variants without extra code. This allows applications to adapt dynamically based on system preferences while using build-in controls. For advanced customization, this documentation explains defining custom variant-dependent resources and their referencing.