Add window opacity slider to the Hellion theme

True per-window focus-aware transparency would require touching
ChatLogWindow and SettingsWindow individually (both upstream code,
both prone to cherry-pick churn). Instead expose a single opacity
slider that mixes a configured alpha into the WindowBg color in
PushGlobal — applies to every Hellion-rendered pane uniformly,
the game shines through, and form fields / dialogs / popups stay
opaque on top so input remains readable.

Default 92%, range clamped to 0.5–1.0 in the UI and 0x55–0xFF in
the alpha conversion so users can't accidentally make the panes
disappear entirely. Slider sits inside the Appearance section
right under the master Hellion-theme checkbox and is greyed out
when the theme is disabled.
This commit is contained in:
2026-05-01 21:22:55 +02:00
parent 07470f527e
commit 7fdbc81c22
7 changed files with 41 additions and 3 deletions
+10 -2
View File
@@ -109,10 +109,18 @@ internal static class HellionStyle
/// Plugin.Draw. Covers every ImGui surface the plugin renders so the
/// Hellion look is consistent across upstream and Hellion tabs.
/// </summary>
internal static IDisposable PushGlobal()
/// <param name="windowOpacity">Window background alpha (0.51.0). Lower
/// values let the game shine through the plugin panes.</param>
internal static IDisposable PushGlobal(float windowOpacity = 1.0f)
{
var stack = new StackHandle();
// Mix the configured opacity into the window background color.
// Other surface layers (ChildBg, FrameBg, popups) stay opaque so
// form fields and dialogs remain easy to read on top.
var alphaByte = (uint)Math.Clamp((int)(windowOpacity * 255f), 0x55, 0xFF);
var windowBgWithAlpha = (WindowBgRgba & 0xFFFFFF00u) | alphaByte;
// Layout — geometric edges, modest rounding, single-pixel borders.
stack.PushStyleVar(ImGuiStyleVar.WindowRounding, 4f);
stack.PushStyleVar(ImGuiStyleVar.ChildRounding, 3f);
@@ -125,7 +133,7 @@ internal static class HellionStyle
stack.PushStyleVar(ImGuiStyleVar.FrameBorderSize, 1f);
// Surfaces.
stack.PushColor(ImGuiCol.WindowBg, WindowBgRgba);
stack.PushColor(ImGuiCol.WindowBg, windowBgWithAlpha);
stack.PushColor(ImGuiCol.ChildBg, ChildBgRgba);
stack.PushColor(ImGuiCol.PopupBg, PopupBgRgba);
stack.PushColor(ImGuiCol.Border, BorderRgba);
+9
View File
@@ -77,6 +77,15 @@ internal sealed class Privacy : ISettingsTab
ref Mutable.HellionThemeEnabled,
HellionStrings.Theme_Enabled_Name,
HellionStrings.Theme_Enabled_Description);
using (ImRaii.Disabled(!Mutable.HellionThemeEnabled))
{
ImGui.Spacing();
var opacity = Mutable.HellionThemeWindowOpacity;
if (ImGui.SliderFloat($"{HellionStrings.Theme_WindowOpacity_Label}##theme-opacity", ref opacity, 0.5f, 1.0f, "%.2f"))
Mutable.HellionThemeWindowOpacity = Math.Clamp(opacity, 0.5f, 1.0f);
ImGuiUtil.HelpText(HellionStrings.Theme_WindowOpacity_Help);
}
}
ImGui.Spacing();