diff --git a/OptiScaler.ini b/OptiScaler.ini index 45e05b2a..94223083 100644 --- a/OptiScaler.ini +++ b/OptiScaler.ini @@ -849,6 +849,10 @@ FpsOverlayAlpha=auto ; -1 -> No shortcut key FGShortcutKey=auto +; Overlays uses the theme colors +; true or false - Default (auto) is false +OverlaysUseTheme=auto + ; Enables Light Theme for Menu ; true or false - Default (auto) is false LightTheme=auto diff --git a/OptiScaler/Config.cpp b/OptiScaler/Config.cpp index 551f6ba4..d682f01a 100644 --- a/OptiScaler/Config.cpp +++ b/OptiScaler/Config.cpp @@ -461,6 +461,7 @@ bool Config::Reload(std::filesystem::path iniPath) FGShortcutKey.set_from_config(readInt("Menu", "FGShortcutKey")); LightTheme.set_from_config(readBool("Menu", "LightTheme")); + OverlaysUseTheme.set_from_config(readBool("Menu", "OverlaysUseTheme")); MenuAccentColorR.set_from_config(readFloat("Menu", "AccentColorR")); MenuAccentColorG.set_from_config(readFloat("Menu", "AccentColorG")); MenuAccentColorB.set_from_config(readFloat("Menu", "AccentColorB")); @@ -1189,6 +1190,7 @@ bool Config::SaveIni() wstring_to_string(Instance()->TTFFontPath.value_for_config_or(L"auto")).c_str()); ini.SetValue("Menu", "LightTheme", GetBoolValue(Instance()->LightTheme.value_for_config()).c_str()); + ini.SetValue("Menu", "OverlaysUseTheme", GetBoolValue(Instance()->OverlaysUseTheme.value_for_config()).c_str()); ini.SetValue("Menu", "AccentColorR", GetFloatValue(Instance()->MenuAccentColorR.value_for_config()).c_str()); ini.SetValue("Menu", "AccentColorG", GetFloatValue(Instance()->MenuAccentColorG.value_for_config()).c_str()); ini.SetValue("Menu", "AccentColorB", GetFloatValue(Instance()->MenuAccentColorB.value_for_config()).c_str()); diff --git a/OptiScaler/Config.h b/OptiScaler/Config.h index ce955578..0dd786df 100644 --- a/OptiScaler/Config.h +++ b/OptiScaler/Config.h @@ -326,6 +326,7 @@ class Config CustomOptional TTFFontPath; CustomOptional FGShortcutKey { VK_END }; CustomOptional LightTheme { false }; + CustomOptional OverlaysUseTheme { false }; CustomOptional MenuAccentColorR { 0.00f }; CustomOptional MenuAccentColorG { 0.40f }; CustomOptional MenuAccentColorB { 0.77f }; diff --git a/OptiScaler/menu/menu_common.cpp b/OptiScaler/menu/menu_common.cpp index e4327a3f..f4d25d5a 100644 --- a/OptiScaler/menu/menu_common.cpp +++ b/OptiScaler/menu/menu_common.cpp @@ -1484,11 +1484,15 @@ void MenuCommon::RenderSplashWindow(RenderMenuContext& ctx) ImGui::PushStyleVar(ImGuiStyleVar_Alpha, windowAlpha); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(12, 8)); - ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0f, 0.0f, 0.0f, 1.0f)); - ImGui::PushStyleColor(ImGuiCol_Text, toneMapColor(ImVec4(1.0f, 1.0f, 1.0f, 1.0f))); ImGui::PushStyleColor(ImGuiCol_Border, IM_COL32(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_FrameBg, IM_COL32(0, 0, 0, 0)); + if (!config->OverlaysUseTheme.value_or_default()) + { + ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0f, 0.0f, 0.0f, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_Text, toneMapColor(ImVec4(1.0f, 1.0f, 1.0f, 1.0f))); + } + if (ImGui::Begin("Splash", nullptr, ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing | @@ -1520,7 +1524,11 @@ void MenuCommon::RenderSplashWindow(RenderMenuContext& ctx) splashPosition.y = io.DisplaySize.y - splashSize.y; } - ImGui::PopStyleColor(4); + if (!config->OverlaysUseTheme.value_or_default()) + ImGui::PopStyleColor(4); + else + ImGui::PopStyleColor(2); + ImGui::PopStyleVar(2); } } @@ -1642,14 +1650,22 @@ void MenuCommon::RenderPerformanceOverlay(RenderMenuContext& ctx) ImGui::SetNextWindowPos(overlayPosition, ImGuiCond_Always); // Set overlay window properties - ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0f, 0.0f, 0.0f, 1.0f)); - ImGui::PushStyleColor(ImGuiCol_Text, toneMapColor(ImVec4(1.0f, 1.0f, 1.0f, 1.0f))); - ImGui::PushStyleColor(ImGuiCol_Border, IM_COL32(0, 0, 0, 0)); // Transparent border - ImGui::PushStyleColor(ImGuiCol_FrameBg, IM_COL32(0, 0, 0, 0)); // Transparent frame background + ImGui::PushStyleColor(ImGuiCol_Border, IM_COL32(0, 0, 0, 0)); // Transparent border + ImGui::PushStyleColor(ImGuiCol_FrameBg, IM_COL32(0, 0, 0, 0)); // Transparent frame background + + if (!config->OverlaysUseTheme.value_or_default()) + { + ImGui::PushStyleColor(ImGuiCol_Text, toneMapColor(ImVec4(1.0f, 1.0f, 1.0f, 1.0f))); + ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0f, 0.0f, 0.0f, 1.0f)); + } + ImGui::SetNextWindowBgAlpha(config->FpsOverlayAlpha.value_or_default()); // Transparent background - ImVec4 green(0.0f, 1.0f, 0.0f, 1.0f); - ImGui::PushStyleColor(ImGuiCol_PlotLines, toneMapColor(green)); + if (!config->OverlaysUseTheme.value_or_default()) + { + ImVec4 green(0.0f, 1.0f, 0.0f, 1.0f); + ImGui::PushStyleColor(ImGuiCol_PlotLines, toneMapColor(green)); + } if (ImGui::Begin("Performance Overlay", nullptr, ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoDecoration | @@ -2010,7 +2026,11 @@ void MenuCommon::RenderPerformanceOverlay(RenderMenuContext& ctx) } } - ImGui::PopStyleColor(5); // Restore the style + // Restore the style + if (!config->OverlaysUseTheme.value_or_default()) + ImGui::PopStyleColor(5); + else + ImGui::PopStyleColor(2); // Get size for postioning overlaySize = ImGui::GetWindowSize(); @@ -6101,6 +6121,10 @@ void MenuCommon::RenderFpsOverlaySettings(RenderMenuContext& ctx) else config->FpsScale = values[currentIndex]; } + + bool useTheme = config->OverlaysUseTheme.value_or_default(); + if (ImGui::Checkbox("Use Theme Colors", &useTheme)) + config->OverlaysUseTheme = useTheme; } }