Add support for custom themes in chardonnay
This commit is contained in:
parent
a37eb383cd
commit
b34970bd47
26 changed files with 719 additions and 280 deletions
|
|
@ -45,7 +45,6 @@ namespace LibationAvalonia.ViewModels.Settings
|
|||
config.CreationTime = CreationTime.Value;
|
||||
config.LastWriteTime = LastWriteTime.Value;
|
||||
config.LogLevel = LoggingLevel;
|
||||
Configuration.Instance.SetString(ThemeVariant, nameof(ThemeVariant));
|
||||
}
|
||||
|
||||
private static float scaleFactorToLinearRange(float scaleFactor)
|
||||
|
|
@ -95,20 +94,7 @@ namespace LibationAvalonia.ViewModels.Settings
|
|||
public string ThemeVariant
|
||||
{
|
||||
get => themeVariant;
|
||||
set
|
||||
{
|
||||
var changed = !value.Equals(themeVariant);
|
||||
this.RaiseAndSetIfChanged(ref themeVariant, value);
|
||||
|
||||
if (changed && App.Current is Avalonia.Application app)
|
||||
app.RequestedThemeVariant = themeVariant switch
|
||||
{
|
||||
nameof(Avalonia.Styling.ThemeVariant.Dark) => Avalonia.Styling.ThemeVariant.Dark,
|
||||
nameof(Avalonia.Styling.ThemeVariant.Light) => Avalonia.Styling.ThemeVariant.Light,
|
||||
// "System"
|
||||
_ => Avalonia.Styling.ThemeVariant.Default
|
||||
};
|
||||
}
|
||||
set => this.RaiseAndSetIfChanged(ref themeVariant, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue