File: os-win10.cpp

package info (click to toggle)
sonic-visualiser 5.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,744 kB
  • sloc: cpp: 158,888; ansic: 11,920; sh: 1,785; makefile: 517; xml: 64; perl: 31
file content (49 lines) | stat: -rw-r--r-- 1,022 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

#ifndef AVOID_WINRT_DEPENDENCY
#ifdef _MSC_VER
#include <winrt/Windows.UI.ViewManagement.h>
#endif
#endif

extern "C" {

bool
OSReportsDarkThemeActive()
{
#ifndef AVOID_WINRT_DEPENDENCY
#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
#endif
    return false;
}

bool
OSQueryAccentColour(int *r, int *g, int *b)
{
#ifndef AVOID_WINRT_DEPENDENCY
#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
#endif
    (void)r;
    (void)g;
    (void)b;
    return false;
}

}