AvaloniaSkinManager 2.0.0
See the version list below for details.
dotnet add package AvaloniaSkinManager --version 2.0.0
NuGet\Install-Package AvaloniaSkinManager -Version 2.0.0
<PackageReference Include="AvaloniaSkinManager" Version="2.0.0" />
<PackageVersion Include="AvaloniaSkinManager" Version="2.0.0" />
<PackageReference Include="AvaloniaSkinManager" />
paket add AvaloniaSkinManager --version 2.0.0
#r "nuget: AvaloniaSkinManager, 2.0.0"
#:package AvaloniaSkinManager@2.0.0
#addin nuget:?package=AvaloniaSkinManager&version=2.0.0
#tool nuget:?package=AvaloniaSkinManager&version=2.0.0
AvaloniaThemeManager
Theme management library for Avalonia UI applications with built-in themes, runtime theme switching, import/export, validation, and ready-made theme UI components.
Package
Install the published package:
dotnet add package AvaloniaSkinManager
What it provides
- 12 built-in themes, including
Dark,Light,Ocean Blue,ModernIce,RetroTerminal, andMaterial Design 3 - runtime theme switching through
ISkinManager - saved-theme restoration during app startup
- theme import/export and theme-pack export helpers
- validation and auto-fix services for custom themes
- ready-to-use UI components:
QuickThemeSwitcherThemeSettingsDialogThemeManagerDemoView
Quick start
1. Configure the app
using Avalonia;
using Avalonia.ReactiveUI;
using AvaloniaThemeManager.Extensions;
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.UseThemeManager()
.WithInterFont()
.UseReactiveUI();
2. Merge the library theme resources
<Application
x:Class="YourApp.App"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://AvaloniaThemeManager/Themes/CustomThemes.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>
3. Resolve and use ISkinManager
using AvaloniaThemeManager.Extensions;
using AvaloniaThemeManager.Theme;
var skinManager = AppBuilderExtensions.GetRequiredService<ISkinManager>();
skinManager.ApplySkin("Dark");
var availableThemes = skinManager.GetAvailableSkinNames();
DI-friendly usage
The library now prefers explicit dependency injection. Compatibility constructors still exist on a few UI types, but new code should pass dependencies explicitly.
Open the theme settings dialog
using AvaloniaThemeManager.Theme;
using AvaloniaThemeManager.Views;
using Microsoft.Extensions.Logging.Abstractions;
var skinManager = AppBuilderExtensions.GetRequiredService<ISkinManager>();
var dialog = new ThemeSettingsDialog(skinManager, NullLogger.Instance);
await dialog.ShowDialog(this);
Use the quick switcher
<UserControl
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:AvaloniaThemeManager.Controls;assembly=AvaloniaThemeManager">
<controls:QuickThemeSwitcher />
</UserControl>
Use the demo view
using AvaloniaThemeManager.Services.Interfaces;
using AvaloniaThemeManager.Theme;
using AvaloniaThemeManager.Views;
using Microsoft.Extensions.Logging.Abstractions;
var skinManager = AppBuilderExtensions.GetRequiredService<ISkinManager>();
var dialogService = AppBuilderExtensions.GetRequiredService<IDialogService>();
var demoView = new ThemeManagerDemoView(
skinManager,
NullLogger.Instance,
dialogService);
Import, export, and validation
using AvaloniaThemeManager.Theme;
var skinManager = AppBuilderExtensions.GetRequiredService<ISkinManager>();
var validator = AppBuilderExtensions.GetRequiredService<IThemeValidator>();
var currentSkin = skinManager.CurrentSkin;
var validation = validator.ValidateTheme(currentSkin!);
if (validation.IsValid)
{
await ThemeImportExport.ExportThemeAsync(currentSkin!, "theme.json");
}
The default export path now writes the full runtime theme model, including typography and control/style URI metadata.
Custom themes
using Avalonia.Media;
using AvaloniaThemeManager.Theme;
var customTheme = new Skin
{
Name = "My Theme",
PrimaryColor = Color.Parse("#343B48"),
SecondaryColor = Color.Parse("#3D4654"),
AccentColor = Color.Parse("#3498DB"),
PrimaryBackground = Color.Parse("#2C313D"),
SecondaryBackground = Color.Parse("#464F62"),
PrimaryTextColor = Color.Parse("#FFFFFF"),
SecondaryTextColor = Color.Parse("#CCCCCC"),
BorderColor = Color.Parse("#5D6778"),
ErrorColor = Color.Parse("#E74C3C"),
WarningColor = Color.Parse("#F39C12"),
SuccessColor = Color.Parse("#2ECC71")
};
var skinManager = AppBuilderExtensions.GetRequiredService<ISkinManager>();
skinManager.RegisterSkin(customTheme.Name, customTheme);
skinManager.ApplySkin(customTheme.Name);
Public services
ISkinManagerIThemeValidatorIThemeAutoFixerIThemeLoaderServiceIDialogServiceThemeInheritanceManager
Notes
- The package ID is
AvaloniaSkinManager. - The library namespace remains
AvaloniaThemeManager. - Startup initialization restores the last saved theme when
UseThemeManager()is used. - Demo and compatibility constructors are still present, but new code should prefer explicit constructors and resolved services.
Changelog
2.0.0
- moved the library to a DI-first model
- removed the old
SkinManager.Instancesingleton path - fixed full-fidelity theme import/export
- fixed inheritable theme resolution for typography and URI overrides
- unified validation policy and split validation from autofix
- reduced demo app and demo view orchestration code-behind
Support
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Avalonia (>= 11.3.13)
- Avalonia.Controls.DataGrid (>= 11.3.13)
- Avalonia.Desktop (>= 11.3.13)
- Avalonia.Fonts.Inter (>= 11.3.13)
- Avalonia.ReactiveUI (>= 11.3.9)
- Avalonia.Themes.Fluent (>= 11.3.13)
- Microsoft.Extensions.Logging (>= 9.0.5)
- Microsoft.Extensions.Logging.Console (>= 9.0.5)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Breaking release: migrated to a DI-first API, removed SkinManager singleton access, fixed full-fidelity theme import/export and inheritable typography or URI resolution, unified validation and autofix behavior, and hardened demo plus dialog coverage.