| 69 | } |
| 70 | |
| 71 | bool 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 | } |
nothing calls this directly
no test coverage detected