AvaloniaSkinManager 1.0.4
dotnet add package AvaloniaSkinManager --version 1.0.4
NuGet\Install-Package AvaloniaSkinManager -Version 1.0.4
<PackageReference Include="AvaloniaSkinManager" Version="1.0.4" />
<PackageVersion Include="AvaloniaSkinManager" Version="1.0.4" />
<PackageReference Include="AvaloniaSkinManager" />
paket add AvaloniaSkinManager --version 1.0.4
#r "nuget: AvaloniaSkinManager, 1.0.4"
#:package AvaloniaSkinManager@1.0.4
#addin nuget:?package=AvaloniaSkinManager&version=1.0.4
#tool nuget:?package=AvaloniaSkinManager&version=1.0.4
AvaloniaThemeManager
A comprehensive theme management library for Avalonia UI applications with multiple built-in themes, dynamic theme switching, and extensive control styling.
Features
- 7 Built-in Themes: Dark, Light, Ocean Blue, Forest Green, Purple Haze, High Contrast, and Cyberpunk
- Dynamic Theme Switching: Change themes at runtime with smooth transitions
- Persistent Settings: Automatically saves and restores user theme preferences
- Comprehensive Styling: Extensive theme support for all major Avalonia controls
- Quick Switcher Control: Ready-to-use theme switcher component
- Theme Settings Dialog: Complete settings UI for theme management
- MVVM Architecture: Reactive and clean separation of concerns
- Easy Integration: Simple setup with AppBuilder extensions
Installation
Install via NuGet Package Manager:
dotnet add package AvaloniaThemeManager
Or via Package Manager Console:
Install-Package AvaloniaThemeManager
Quick Start
1. Setup in Program.cs
using Avalonia;
using AvaloniaThemeManager.Extensions;
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.UseThemeManager() // Add this line
.LogToTrace()
.UseReactiveUI();
2. Include Styles in App.axaml
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="YourApp.App">
<Application.Resources>
<ResourceDictionary>
<ResourceInclude Source="avares://AvaloniaThemeManager/Themes/CustomThemes.axaml" />
</ResourceDictionary>
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>
3. Basic Theme Switching
using AvaloniaThemeManager.Theme;
// Switch to a different theme
SkinManager.Instance.ApplySkin("Dark");
SkinManager.Instance.ApplySkin("Ocean Blue");
SkinManager.Instance.ApplySkin("Cyberpunk");
// Get available themes
var availableThemes = SkinManager.Instance.GetAvailableSkinNames();
// Listen for theme changes
SkinManager.Instance.SkinChanged += (sender, args) =>
{
Console.WriteLine("Theme changed!");
};
Built-in Themes
Theme Name | Description | Preview |
---|---|---|
Dark | Professional dark theme with blue accents | |
Light | Clean light theme perfect for bright environments | |
Ocean Blue | Deep blue theme inspired by ocean depths | |
Forest Green | Nature-inspired green theme | |
Purple Haze | Rich purple theme with mystical vibes | |
High Contrast | Maximum contrast for accessibility | |
Cyberpunk | Futuristic neon theme with hot pink accents |
Usage Examples
Using the Quick Theme Switcher Control
<UserControl xmlns:controls="clr-namespace:AvaloniaThemeManager.Controls;assembly=AvaloniaThemeManager">
<StackPanel>
<controls:QuickThemeSwitcher />
<Button Content="Sample Button" />
<TextBox Watermark="Sample TextBox" />
</StackPanel>
</UserControl>
Opening the Theme Settings Dialog
using AvaloniaThemeManager.Views;
private async void OpenThemeSettings()
{
var dialog = new ThemeSettingsDialog();
await dialog.ShowDialog(this); // 'this' is your parent window
}
Creating Custom Themes
using AvaloniaThemeManager.Theme;
using Avalonia.Media;
// Create a custom theme
var customTheme = new Skin
{
Name = "My Custom Theme",
PrimaryColor = Color.Parse("#FF6B6B"),
SecondaryColor = Color.Parse("#4ECDC4"),
AccentColor = Color.Parse("#45B7D1"),
PrimaryBackground = Color.Parse("#2C3E50"),
SecondaryBackground = Color.Parse("#34495E"),
PrimaryTextColor = Color.Parse("#FFFFFF"),
SecondaryTextColor = Color.Parse("#BDC3C7"),
BorderColor = Color.Parse("#7F8C8D"),
ErrorColor = Color.Parse("#E74C3C"),
WarningColor = Color.Parse("#F39C12"),
SuccessColor = Color.Parse("#2ECC71")
};
// Register and apply the custom theme
SkinManager.Instance.RegisterSkin("Custom", customTheme);
SkinManager.Instance.ApplySkin("Custom");
Advanced Configuration
// Configure theme manager during startup
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.UseThemeManager(manager =>
{
// Register custom themes
manager.RegisterSkin("Corporate", corporateTheme);
// Set default theme
manager.ApplySkin("Dark");
})
.LogToTrace()
.UseReactiveUI();
MVVM Integration
Theme Settings ViewModel
using AvaloniaThemeManager.ViewModels;
public class MainWindowViewModel : ViewModelBase
{
public ThemeSettingsViewModel ThemeSettings { get; }
public MainWindowViewModel()
{
ThemeSettings = new ThemeSettingsViewModel();
}
}
Data Binding in XAML
<Window xmlns:vm="clr-namespace:AvaloniaThemeManager.ViewModels;assembly=AvaloniaThemeManager">
<ComboBox ItemsSource="{Binding ThemeSettings.AvailableThemes}"
SelectedItem="{Binding ThemeSettings.SelectedTheme}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Spacing="8">
<Ellipse Width="12" Height="12" Fill="{Binding PreviewColor}" />
<TextBlock Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Window>
Styled Controls
AvaloniaThemeManager provides comprehensive styling for:
- Buttons (Primary, Secondary, Browse, Toolbar variants)
- TextBoxes (Standard, Dialog variants)
- ComboBoxes and ComboBoxItems
- CheckBoxes with custom styling
- TabControls and TabItems
- Borders (Default, Card, Status Bar, Toolbar variants)
- TextBlocks (Various typography styles)
- Separators (Horizontal and Vertical)
- PathIcons with multiple size variants
- Expanders with animated transitions
- Windows (Default and Dialog variants)
Persistence
Theme preferences are automatically saved to:
- Windows:
%LocalAppData%/ResumeForge/appsettings.json
- macOS:
~/Library/Application Support/ResumeForge/appsettings.json
- Linux:
~/.local/share/ResumeForge/appsettings.json
Requirements
- .NET 8.0 or higher
- Avalonia UI 11.3.0 or higher
- C# 12 language features
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Development Setup
- Clone the repository
- Open in Visual Studio 2022 or JetBrains Rider
- Restore NuGet packages
- Build and run the sample application
Adding New Themes
- Create a new
Skin
object with your color scheme - Register it in
SkinManager.RegisterDefaultSkins()
- Add theme description in
GetThemeDescription()
method - Test with all styled controls
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
v1.0.0 (2025-01-XX)
- Initial release
- 7 built-in themes
- Comprehensive control styling
- Dynamic theme switching
- Settings persistence
- Quick switcher component
- Theme settings dialog
- MVVM architecture
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Wiki
Acknowledgments
- Built with Avalonia UI
- Inspired by Material Design and Fluent Design principles
- Icons from Material Design Icons
Made with ❤️ for the Avalonia UI community
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.0)
- Avalonia.Controls.DataGrid (>= 11.3.0)
- Avalonia.Desktop (>= 11.3.0)
- Avalonia.Fonts.Inter (>= 11.3.0)
- Avalonia.ReactiveUI (>= 11.3.0)
- Avalonia.Themes.Fluent (>= 11.3.0)
- 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.
Initial release with comprehensive theme management capabilities.