mirror of
https://github.com/holgerb83/ModernWpfPlayground.git
synced 2025-04-16 21:43:51 +02:00
26 lines
755 B
C#
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)
|
|
};
|
|
}
|
|
}
|
|
} |