Mercurial > hg > svcore
diff system/System.cpp @ 1822:0bc6caf87658
Merge from branch background-mode
author | Chris Cannam |
---|---|
date | Fri, 24 Jan 2020 15:10:35 +0000 |
parents | 472865574b1a |
children | 029d7d3f0a3a |
line wrap: on
line diff
--- a/system/System.cpp Tue Jan 14 15:48:22 2020 +0000 +++ b/system/System.cpp Fri Jan 24 15:10:35 2020 +0000 @@ -27,6 +27,10 @@ #include <unistd.h> #endif +#ifdef _MSC_VER +#include <winrt/Windows.UI.ViewManagement.h> +#endif + #ifdef __APPLE__ #include <sys/param.h> #include <sys/sysctl.h> @@ -334,6 +338,39 @@ } } +bool +OSReportsDarkThemeActive() +{ + SVCERR << "OSReportsDarkThemeActive() called" << endl; +#ifdef _MSC_VER + using namespace winrt::Windows::UI::ViewManagement; + UISettings settings; + auto background = settings.GetColorValue(UIColorType::Background); + if (int(background.R) + int(background.G) + int(background.B) < 384) { + return true; + } +#endif + return false; +} + +bool +OSQueryAccentColour(int &r, int &g, int &b) +{ + SVCERR << "OSQueryAccentColour() called" << endl; +#ifdef _MSC_VER + using namespace winrt::Windows::UI::ViewManagement; + bool dark = OSReportsDarkThemeActive(); + UISettings settings; + auto accent = settings.GetColorValue + (dark ? UIColorType::AccentLight1 : UIColorType::Accent); + r = accent.R; + g = accent.G; + b = accent.B; + return true; +#endif + return false; +} + double mod(double x, double y) { return x - (y * floor(x / y)); } float modf(float x, float y) { return x - (y * floorf(x / y)); }