-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the dark mode and highcontrast mode detection when starting the…
… app (might be useful to add a watcher to react to system settings updates). #141
- Loading branch information
Showing
3 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Microsoft.Win32; | ||
|
||
using System; | ||
using System.Linq; | ||
using System.Windows; | ||
|
||
namespace Wokhan.WindowsFirewallNotifier.Common.UI.Themes | ||
{ | ||
public static partial class ThemeHelper | ||
{ | ||
public static string GetCurrentTheme() | ||
{ | ||
if (SystemParameters.HighContrast) | ||
{ | ||
return "System"; | ||
} | ||
|
||
using (RegistryKey? key = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize")) | ||
{ | ||
return (int?)key?.GetValue("AppsUseLightTheme") == 0 ? "Dark" : "Light"; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters