refactor(theme): extract ChildBgAlpha threshold logic to testable helper (F1.2)

HellionStyle.PushGlobal had two lines that resolved the child-bg alpha
based on window opacity. Moves the 0.999f threshold and the alpha-mask
into HellionStyleHelpers.ResolveChildBgAlpha so the logic is reachable
from the build suite without touching the ImGui surface.
This commit is contained in:
2026-05-12 18:19:15 +02:00
parent dd597fca44
commit 28ea2fa553
2 changed files with 21 additions and 7 deletions
+4 -7
View File
@@ -43,13 +43,10 @@ internal static class HellionStyle
var alphaByte = (uint)Math.Clamp((int)(windowOpacity * 255f), 0x55, 0xFF);
var windowBgWithAlpha = (c.WindowBg & 0xFFFFFF00u) | alphaByte;
// ChildBg alpha: child areas rendered inside ChatLogWindow would
// multiply their alpha with WindowBg, making 50% opacity appear
// ~75% solid. At full opacity the theme's alpha is preserved; below
// it ChildBg goes fully transparent so only WindowBg sets the final
// coverage.
var childBgAlpha = windowOpacity >= 0.999f ? (c.ChildBg & 0xFFu) : 0u;
var childBgWithAlpha = (c.ChildBg & 0xFFFFFF00u) | childBgAlpha;
// ChildBg alpha resolution lives in HellionStyleHelpers so the
// threshold logic can be covered by a pure-helper test in the
// build suite.
var childBgWithAlpha = HellionStyleHelpers.ResolveChildBgAlpha(c.ChildBg, windowOpacity);
// Layout
stack.PushStyleVar(ImGuiStyleVar.WindowRounding, l.WindowRounding);