Mercurial > hg > svcore
changeset 1820:fc18ce2d99d7 background-mode
Add OSQueryAccentColour
author | Chris Cannam |
---|---|
date | Thu, 23 Jan 2020 15:43:30 +0000 |
parents | 4eda6ba5b5d8 |
children | 472865574b1a |
files | system/System.cpp system/System.h |
diffstat | 2 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/system/System.cpp Mon Jan 20 17:17:45 2020 +0000 +++ b/system/System.cpp Thu Jan 23 15:43:30 2020 +0000 @@ -353,6 +353,22 @@ return false; } +bool +OSQueryAccentColour(int &r, int &g, int &b) +{ + SVCERR << "OSQueryAccentColour() called" << endl; +#ifdef _MSC_VER + using namespace winrt::Windows::UI::ViewManagement; + UISettings settings; + auto background = settings.GetColorValue(UIColorType::Accent); + r = background.R; + g = background.G; + b = background.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)); }
--- a/system/System.h Mon Jan 20 17:17:45 2020 +0000 +++ b/system/System.h Thu Jan 23 15:43:30 2020 +0000 @@ -168,6 +168,12 @@ // is unknown. extern bool OSReportsDarkThemeActive(); +// Return true if the OS desktop reports an accent colour to go with +// the current theme; if so, also return by reference the r, g, and b +// components of the colour (range 0-255). Return false if we can't +// query such a thing. +extern bool OSQueryAccentColour(int &r, int &g, int &b); + extern void StoreStartupLocale(); extern void RestoreStartupLocale();