# HG changeset patch # User Chris Cannam # Date 1579794210 0 # Node ID fc18ce2d99d7d717fd7c377eb31002c9992f7bbb # Parent 4eda6ba5b5d8dd6741049c91f73269bc8a773857 Add OSQueryAccentColour diff -r 4eda6ba5b5d8 -r fc18ce2d99d7 system/System.cpp --- 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)); } diff -r 4eda6ba5b5d8 -r fc18ce2d99d7 system/System.h --- 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();