diff --git a/lib/libimhex/source/api/theme_manager.cpp b/lib/libimhex/source/api/theme_manager.cpp index 9aab2b492..7851cb855 100644 --- a/lib/libimhex/source/api/theme_manager.cpp +++ b/lib/libimhex/source/api/theme_manager.cpp @@ -16,22 +16,9 @@ namespace hex { AutoReset> s_styleHandlers; AutoReset s_imageTheme; AutoReset s_currTheme; - AutoReset> s_accentColor; - ImColor s_accentBaseColor; + AutoReset> s_accentColor; std::recursive_mutex s_themeMutex; - - std::tuple getHSV(const ImColor &color) { - float h, s, v; - ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, h, s, v); - return { h, s, v }; - } - - ImColor getRGB(float h, float s, float v, float a) { - float r, g, b; - ImGui::ColorConvertHSVtoRGB(h, s, v, r, g, b); - return ImColor(r, g, b, a); - } } @@ -155,10 +142,6 @@ namespace hex { } } - if (theme.contains("base_color")) { - s_accentBaseColor = parseColorString(theme["base_color"].get()).value_or(ImColor(1.0F, 1.0F, 1.0F)); - } - if (theme.contains("colors") && !s_themeHandlers->empty()) { for (const auto&[type, content] : theme["colors"].items()) { if (!s_themeHandlers->contains(type)) { @@ -187,15 +170,12 @@ namespace hex { } if (accentableColor && s_accentColor->has_value()) { - const auto [baseH, baseS, baseV] = getHSV(s_accentBaseColor); - const auto [accentH, accentS, accentV] = getHSV(s_accentColor->value()); - auto [colorH, colorS, colorV] = getHSV(color.value()); + float h, s, v; + ImGui::ColorConvertRGBtoHSV(color->Value.x, color->Value.y, color->Value.z, h, s, v); - colorH = std::max(colorH - baseH, 0.0F) + accentH; - colorS = std::max(colorS - baseS, 0.0F) + accentS; - colorV = std::max(colorV - baseV, 0.0F) + accentV; + h = s_accentColor->value(); - color = getRGB(colorH, colorS, colorV, color->Value.w); + ImGui::ColorConvertHSVtoRGB(h, s, v, color->Value.x, color->Value.y, color->Value.z); } (*s_themeHandlers)[type].setFunction((*s_themeHandlers)[type].colorMap.at(key), color.value()); @@ -274,7 +254,10 @@ namespace hex { } void ThemeManager::setAccentColor(const ImColor &color) { - s_accentColor = color; + float h, s, v; + ImGui::ColorConvertRGBtoHSV(color.Value.x, color.Value.y, color.Value.z, h, s, v); + + s_accentColor = h; reapplyCurrentTheme(); } diff --git a/plugins/builtin/romfs/themes/classic.json b/plugins/builtin/romfs/themes/classic.json index 801a08200..8c365c00c 100644 --- a/plugins/builtin/romfs/themes/classic.json +++ b/plugins/builtin/romfs/themes/classic.json @@ -1,6 +1,5 @@ { "base": "Classic", - "base_color": "#59669B9E", "colors": { "imgui": { "border": "#7F7F7F7F", diff --git a/plugins/builtin/romfs/themes/dark.json b/plugins/builtin/romfs/themes/dark.json index 6aa2a4ea8..4db34e6b2 100644 --- a/plugins/builtin/romfs/themes/dark.json +++ b/plugins/builtin/romfs/themes/dark.json @@ -1,6 +1,5 @@ { "base": "Dark", - "base_color": "#4296F966", "colors": { "imgui": { "border": "#6D6D7F7F", diff --git a/plugins/builtin/romfs/themes/light.json b/plugins/builtin/romfs/themes/light.json index 2be5b53b2..77783b840 100644 --- a/plugins/builtin/romfs/themes/light.json +++ b/plugins/builtin/romfs/themes/light.json @@ -1,6 +1,5 @@ { "base": "Light", - "base_color": "#4296F966", "colors": { "imgui": { "border": "#0000004C",