2021-10-27 22:56:36 +02:00

26 lines
755 B
C#

using System.ComponentModel;
using ModernWpf;
namespace ModernWpfPlayground.Types
{
public enum ThemeMode
{
[Description("Light")] Light,
[Description("Dark")] Dark,
[Description("Use system setting")] UseSystemSetting
}
public static class ThemeModeExtension
{
public static ApplicationTheme? ToApplicationTheme(this ThemeMode themeMode)
{
return themeMode switch
{
ThemeMode.Light => ApplicationTheme.Light,
ThemeMode.Dark => ApplicationTheme.Dark,
ThemeMode.UseSystemSetting => default,
_ => throw new ArgumentOutOfRangeException(nameof(themeMode), themeMode, null)
};
}
}
}