mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Use WinRT to get dark theme
This commit is contained in:
parent
5d1aa50753
commit
4795bf8b66
@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Win32;
|
using Windows.UI.ViewManagement;
|
||||||
|
|
||||||
namespace Bloxstrap.Extensions
|
namespace Bloxstrap.Extensions
|
||||||
{
|
{
|
||||||
@ -9,9 +9,9 @@ namespace Bloxstrap.Extensions
|
|||||||
if (dialogTheme != Theme.Default)
|
if (dialogTheme != Theme.Default)
|
||||||
return dialogTheme;
|
return dialogTheme;
|
||||||
|
|
||||||
using var key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize");
|
var settings = new UISettings();
|
||||||
|
var background = settings.GetColorValue(UIColorType.Background);
|
||||||
if (key?.GetValue("AppsUseLightTheme") is int value && value == 0)
|
if (((5 * background.G) + (2 * background.R) + background.B) < (8 * 128))
|
||||||
return Theme.Dark;
|
return Theme.Dark;
|
||||||
|
|
||||||
return Theme.Light;
|
return Theme.Light;
|
||||||
|
Loading…
Reference in New Issue
Block a user