Added OverlaysUseTheme option

This commit is contained in:
cdozdil
2026-06-16 18:04:58 +03:00
parent 9383413549
commit 12b321380b
4 changed files with 41 additions and 10 deletions
+4
View File
@@ -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
+2
View File
@@ -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());
+1
View File
@@ -326,6 +326,7 @@ class Config
CustomOptional<std::wstring, NoDefault> TTFFontPath;
CustomOptional<int> FGShortcutKey { VK_END };
CustomOptional<bool> LightTheme { false };
CustomOptional<bool> OverlaysUseTheme { false };
CustomOptional<float> MenuAccentColorR { 0.00f };
CustomOptional<float> MenuAccentColorG { 0.40f };
CustomOptional<float> MenuAccentColorB { 0.77f };
+34 -10
View File
@@ -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;
}
}