https://github.com/bigbuildbench/wieslawsoltes_avalonia.thememanager
https://github.com/bigbuildbench/wieslawsoltes_avalonia.thememanager
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (7.6%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: BigBuildBench
- License: mit
- Language: C#
- Default Branch: master
- Size: 129 KB
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
Avalonia Theme Manager
About
Theme manager for Avalonia applications.
Usage
Theme manager searches user provided themes directory for *.xaml theme files otherwise built-in Light and Dark theme are used.
The ThemeSelector is created and initalized by calling static Create method.
The ThemeSelector uses Styles[0] property of Window to insert selected theme Style.
App.xaml
XAML
<Application x:Class="AvaloniaApp.App"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Styles>
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/>
</Application.Styles>
</Application>
App.xaml.cs
```C#
using System;
using Avalonia;
using Avalonia.Logging.Serilog;
using Avalonia.Markup.Xaml;
using Avalonia.ThemeManager;
namespace AvaloniaApp { public class App : Application { public static ThemeSelector Selector;
[STAThread]
static void Main(string[] args)
{
BuildAvaloniaApp().Start(AppMain, args);
}
static void AppMain(Application app, string[] args)
{
Selector = ThemeSelector.Create("Themes");
Selector.LoadSelectedTheme("AvaloniaApp.theme");
app.Run(new MainWindow());
Selector.SaveSelectedTheme("AvaloniaApp.theme");
}
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.UseReactiveUI()
.LogToDebug();
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
}
} ```
MainWindow.xaml
XAML
<Window x:Class="AvaloniaApp.MainWindow"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:app="clr-namespace:AvaloniaApp;assembly=AvaloniaApp"
xmlns:manager="clr-namespace:Avalonia.ThemeManager;assembly=Avalonia.ThemeManager"
Title="AvaloniaApp" Width="800" Height="600"
Foreground="{DynamicResource ThemeForegroundBrush}">
<Window.Resources>
<manager:ObjectEqualityMultiConverter x:Key="ObjectEqualityMultiConverter"/>
</Window.Resources>
<Grid RowDefinitions="Auto,*">
<Menu Grid.Row="0">
<MenuItem Header="_View">
<MenuItem Header="_Theme" DataContext="{x:Static app:App.Selector}" Items="{Binding Themes}">
<MenuItem.Styles>
<Style Selector="MenuItem">
<Setter Property="Header" Value="{Binding Name}"/>
<Setter Property="Command" Value="{Binding Selector.ApplyTheme}"/>
<Setter Property="CommandParameter" Value="{Binding}"/>
<Setter Property="Icon">
<Template>
<CheckBox>
<CheckBox.IsChecked>
<MultiBinding Mode="OneWay" Converter="{StaticResource ObjectEqualityMultiConverter}">
<Binding Path="DataContext" RelativeSource="{RelativeSource Self}"/>
<Binding Path="Selector.SelectedTheme"/>
</MultiBinding>
</CheckBox.IsChecked>
</CheckBox>
</Template>
</Setter>
</Style>
</MenuItem.Styles>
</MenuItem>
</MenuItem>
</Menu>
</Grid>
</Window>
MainWindow.xaml.xs
```C#
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.ThemeManager;
namespace AvaloniaApp { public partial class MainWindow : Window { public MainWindow() { this.InitializeComponent(); this.AttachDevTools(); App.Selector.EnableThemes(this); }
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
} ```
The EnableThemes(...); can be used to enable themes for multiple windows.
NuGet
Avalonia theme manager is delivered as a NuGet package.
You can find the packages here NuGet and install the package like this:
Install-Package Avalonia.ThemeManager
or by using nightly build feed:
* Add https://www.myget.org/F/avaloniathememanager-nightly/api/v2 to your package sources
* Alternative nightly build feed https://pkgs.dev.azure.com/wieslawsoltes/GitHub/_packaging/Nightly/nuget/v3/index.json
* Update your package using Avalonia.ThemeManager feed
and install the package like this:
Install-Package Avalonia.ThemeManager -Pre
License
Avalonia.ThemeManager is licensed under the MIT license.
Owner
- Name: BigBuildBench
- Login: BigBuildBench
- Kind: organization
- Repositories: 1
- Profile: https://github.com/BigBuildBench
abbr. B3, benchmarking the repo-level understanding capability of your LLMs by reconstructing project build-file.
GitHub Events
Total
- Create event: 5
Last Year
- Create event: 5
Dependencies
- actions/checkout v1 composite
- actions/setup-dotnet v1 composite