WindowsAppearance
class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Skinning
Reads the light or dark mode and the accent colour the user has chosen in Windows' personalisation settings.
public static class WindowsAppearance
Remarks
Both are read afresh on every call, so they always say how Windows is set now. Neither throws: a setting that cannot be read gives the light mode and no accent.
Examples
Color accent = WindowsAppearance.AccentColor ?? BinarySkins.DefaultAccent;
BinarySkinTheme theme = WindowsAppearance.IsDarkMode ? BinarySkinTheme.Black : BinarySkinTheme.White;
BinarySkinManager.Apply(BinarySkins.Create(theme, accent));Members at a glance
| Properties | |
|---|---|
AccentColor | Gets the accent colour chosen in Windows. |
IsDarkMode | Gets whether Windows is set to dark mode for applications. |
Properties
AccentColor static
public static Color? AccentColor
Gets the accent colour chosen in Windows.
- Value
- The accent, opaque;
nullwhere Windows does not keep one or it cannot be read.
IsDarkMode static
public static bool IsDarkMode
Gets whether Windows is set to dark mode for applications.
- Value
truewhen the user has chosen dark for apps;falsewhen light, or when the setting cannot be read (Windows before 10).