MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / IsDarkTheme

Method IsDarkTheme

qt/OpenRGBThemeManager.cpp:71–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71bool OpenRGBThemeManager::IsDarkTheme()
72{
73
74 /*-------------------------------------------------*\
75 | Dark theme settings |
76 \*-------------------------------------------------*/
77 json theme_settings;
78
79 /*-------------------------------------------------*\
80 | Get prefered theme from settings manager |
81 \*-------------------------------------------------*/
82 theme_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Theme");
83
84 /*-------------------------------------------------*\
85 | Read the theme key and adjust accordingly |
86 \*-------------------------------------------------*/
87 std::string current_theme = "light";
88
89 if(theme_settings.contains("theme"))
90 {
91 current_theme = theme_settings["theme"];
92 }
93
94 if(current_theme == "dark")
95 {
96 return true;
97 }
98#ifdef _WIN32
99 else if(current_theme == "auto")
100 {
101 QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", QSettings::NativeFormat);
102
103 if(settings.value("AppsUseLightTheme") != 0)
104 {
105 return false;
106 }
107 else
108 {
109 return true;
110 }
111 }
112
113 return false;
114#endif
115
116 return false;
117}

Callers

nothing calls this directly

Calls 5

GetSettingsMethod · 0.80
GetSettingsManagerMethod · 0.80
containsMethod · 0.80
getFunction · 0.50
valueMethod · 0.45

Tested by

no test coverage detected