mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-08-25 07:36:45 +00:00
Added background alpha
This commit is contained in:
+8
-2
@@ -809,18 +809,24 @@ LightTheme=auto
|
||||
|
||||
; Accent color for the menu
|
||||
; R/G/B float colors values of the accent color for the menu
|
||||
; 0.0 to 1.0 - Default (auto) R: 0.00f, G: 0.40f, B: 0.77f (Blue)
|
||||
; 0.0 to 1.0 - Default (auto) R: 0.0, G: 0.4, B: 0.77 (Blue)
|
||||
AccentColorR=auto
|
||||
AccentColorG=auto
|
||||
AccentColorB=auto
|
||||
|
||||
; Background color for the menu
|
||||
; R/G/B float colors values of the accent color for the menu
|
||||
; 0.0 to 1.0 - Default (auto) R: 0.0f, G: 0.0f, B: 0.0f (Black)
|
||||
; 0.0 to 1.0 - Default (auto) R: 0.0, G: 0.0, B: 0.0 (Black)
|
||||
BGColorR=auto
|
||||
BGColorG=auto
|
||||
BGColorB=auto
|
||||
|
||||
; Background alpha for the menu
|
||||
; 0 is transparent and 1 is opaque
|
||||
; 0.0 to 1.0 - Default (auto) 0.99
|
||||
BGColorA=auto
|
||||
|
||||
|
||||
|
||||
|
||||
; -------------------------------------------------------
|
||||
|
||||
@@ -432,6 +432,7 @@ bool Config::Reload(std::filesystem::path iniPath)
|
||||
MenuBGColorR.set_from_config(readFloat("Menu", "BGColorR"));
|
||||
MenuBGColorG.set_from_config(readFloat("Menu", "BGColorG"));
|
||||
MenuBGColorB.set_from_config(readFloat("Menu", "BGColorB"));
|
||||
MenuBGColorA.set_from_config(readFloat("Menu", "BGColorA"));
|
||||
}
|
||||
|
||||
// Hooks
|
||||
@@ -1106,6 +1107,7 @@ bool Config::SaveIni()
|
||||
ini.SetValue("Menu", "BGColorR", GetFloatValue(Instance()->MenuBGColorR.value_for_config()).c_str());
|
||||
ini.SetValue("Menu", "BGColorG", GetFloatValue(Instance()->MenuBGColorG.value_for_config()).c_str());
|
||||
ini.SetValue("Menu", "BGColorB", GetFloatValue(Instance()->MenuBGColorB.value_for_config()).c_str());
|
||||
ini.SetValue("Menu", "BGColorA", GetFloatValue(Instance()->MenuBGColorA.value_for_config()).c_str());
|
||||
}
|
||||
|
||||
// Hooks
|
||||
|
||||
@@ -312,6 +312,7 @@ class Config
|
||||
CustomOptional<float> MenuBGColorR { 0.0f };
|
||||
CustomOptional<float> MenuBGColorG { 0.0f };
|
||||
CustomOptional<float> MenuBGColorB { 0.0f };
|
||||
CustomOptional<float> MenuBGColorA { 0.99f };
|
||||
|
||||
// Hooks
|
||||
CustomOptional<bool> HookOriginalNvngxOnly { false };
|
||||
|
||||
@@ -1733,13 +1733,17 @@ static void ApplyThemeStyle()
|
||||
|
||||
ImVec4* c = ImGui::GetStyle().Colors;
|
||||
|
||||
float minAlpha = Config::Instance()->MenuBGColorA.value_or_default() >= 0.5f
|
||||
? Config::Instance()->MenuBGColorA.value_or_default()
|
||||
: 0.5f;
|
||||
|
||||
c[ImGuiCol_Text] = textPrimary;
|
||||
c[ImGuiCol_TextDisabled] = textDim;
|
||||
c[ImGuiCol_TextLink] = AccentReadable();
|
||||
|
||||
// MenuBGColor only.
|
||||
c[ImGuiCol_WindowBg] = BgTint(bgDark, 1.00f);
|
||||
c[ImGuiCol_ChildBg] = BgTint(bgMid, 1.10f);
|
||||
c[ImGuiCol_WindowBg] = BgTint(bgDark, 1.00f, Config::Instance()->MenuBGColorA.value_or_default());
|
||||
c[ImGuiCol_ChildBg] = BgTint(bgMid, 1.10f, minAlpha + 0.1f);
|
||||
c[ImGuiCol_PopupBg] =
|
||||
lightTheme ? BgTint(bgLight, 0.90f) : BgTint(ImVec4(0.09f, 0.10f, 0.13f, 0.97f), 0.90f, 0.97f);
|
||||
c[ImGuiCol_MenuBarBg] = BgTint(bgDark, 0.85f);
|
||||
@@ -1749,7 +1753,7 @@ static void ApplyThemeStyle()
|
||||
c[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||
|
||||
// Neutral background, not MenuBGColor.
|
||||
c[ImGuiCol_FrameBg] = BgTint(bgLight, 0.50f);
|
||||
c[ImGuiCol_FrameBg] = BgTint(bgLight, 0.50f, minAlpha + 0.15f);
|
||||
c[ImGuiCol_FrameBgHovered] = SurfaceHover();
|
||||
c[ImGuiCol_FrameBgActive] = SurfaceActive();
|
||||
|
||||
@@ -1757,7 +1761,7 @@ static void ApplyThemeStyle()
|
||||
c[ImGuiCol_TitleBgActive] = TitleActive();
|
||||
c[ImGuiCol_TitleBgCollapsed] = ImVec4(bgTitle.x, bgTitle.y, bgTitle.z, 0.75f);
|
||||
|
||||
c[ImGuiCol_ScrollbarBg] = BgTint(bgDark, 0.60f);
|
||||
c[ImGuiCol_ScrollbarBg] = BgTint(bgDark, 0.60f, minAlpha + 0.2f);
|
||||
c[ImGuiCol_ScrollbarGrab] = AccentSoft();
|
||||
c[ImGuiCol_ScrollbarGrabHovered] = AccentMed();
|
||||
c[ImGuiCol_ScrollbarGrabActive] = AccentStrong();
|
||||
@@ -1798,10 +1802,10 @@ static void ApplyThemeStyle()
|
||||
c[ImGuiCol_PlotHistogram] = PlotAccent(0.85f);
|
||||
c[ImGuiCol_PlotHistogramHovered] = PlotAccentHovered();
|
||||
|
||||
c[ImGuiCol_TableHeaderBg] = BgTint(bgMid, 0.80f);
|
||||
c[ImGuiCol_TableHeaderBg] = BgTint(bgMid, 0.80f, minAlpha + 0.25f);
|
||||
c[ImGuiCol_TableBorderStrong] = borderCol;
|
||||
c[ImGuiCol_TableBorderLight] = lightTheme ? ImVec4(0.68f, 0.72f, 0.80f, 1.00f) : AccentSoft();
|
||||
c[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||
c[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.0f);
|
||||
c[ImGuiCol_TableRowBgAlt] = lightTheme ? ImVec4(0.00f, 0.00f, 0.00f, 0.045f) : ImVec4(1.00f, 1.00f, 1.00f, 0.03f);
|
||||
|
||||
c[ImGuiCol_TreeLines] = borderCol;
|
||||
@@ -5953,6 +5957,8 @@ bool MenuCommon::RenderMenu()
|
||||
ImGui::PopStyleColor(3);
|
||||
}
|
||||
|
||||
ImGui::SameLine(0.0f, 6.0f);
|
||||
|
||||
float accentColor[3] = { config->MenuAccentColorR.value_or_default(),
|
||||
config->MenuAccentColorG.value_or_default(),
|
||||
config->MenuAccentColorB.value_or_default() };
|
||||
@@ -6141,11 +6147,21 @@ bool MenuCommon::RenderMenu()
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
auto alpha = config->MenuBGColorA.value_or_default();
|
||||
if (ImGui::SliderFloat("Background Alpha", &alpha, 0.0f, 1.0f))
|
||||
{
|
||||
config->MenuBGColorA = alpha;
|
||||
ApplyThemeStyle();
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::Button("Reset BG Colour"))
|
||||
{
|
||||
config->MenuBGColorR.reset();
|
||||
config->MenuBGColorG.reset();
|
||||
config->MenuBGColorB.reset();
|
||||
config->MenuBGColorA.reset();
|
||||
ApplyThemeStyle();
|
||||
}
|
||||
|
||||
@@ -6650,7 +6666,7 @@ bool MenuCommon::RenderMenu()
|
||||
|
||||
ImGui::SameLine(0.0f, 15.0f);
|
||||
|
||||
if (ImGui::Button("Save INI"))
|
||||
if (ImGui::Button("Save Settings"))
|
||||
config->SaveIni();
|
||||
|
||||
ImGui::SameLine(0.0f, 6.0f);
|
||||
|
||||
Reference in New Issue
Block a user