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:
@@ -71,6 +71,10 @@ public class Configuration : IPluginConfiguration
|
||||
// can flip this off in the Privacy tab.
|
||||
public bool HellionThemeEnabled = true;
|
||||
|
||||
// Window background opacity, 0.5–1.0. Lower values make the plugin
|
||||
// panes more glass-like so the game shines through. Default ~92%.
|
||||
public float HellionThemeWindowOpacity = 0.92f;
|
||||
|
||||
public int GetRetentionDays(ChatType type)
|
||||
{
|
||||
if (RetentionPerChannelDays.TryGetValue(type, out var userOverride))
|
||||
@@ -250,6 +254,7 @@ public class Configuration : IPluginConfiguration
|
||||
|
||||
FirstRunCompleted = other.FirstRunCompleted;
|
||||
HellionThemeEnabled = other.HellionThemeEnabled;
|
||||
HellionThemeWindowOpacity = other.HellionThemeWindowOpacity;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -389,7 +389,9 @@ public sealed class Plugin : IDalamudPlugin
|
||||
// (chat log, settings, viewers, wizard, file dialog) renders with
|
||||
// the same palette. Skipping the push leaves the upstream Dalamud
|
||||
// look untouched for users who flipped the toggle off.
|
||||
using IDisposable? _style = Config.HellionThemeEnabled ? HellionStyle.PushGlobal() : null;
|
||||
using IDisposable? _style = Config.HellionThemeEnabled
|
||||
? HellionStyle.PushGlobal(Config.HellionThemeWindowOpacity)
|
||||
: null;
|
||||
|
||||
ChatLogWindow.BeginFrame();
|
||||
|
||||
|
||||
+2
@@ -134,4 +134,6 @@ internal class HellionStrings
|
||||
internal static string Theme_Heading => Get(nameof(Theme_Heading));
|
||||
internal static string Theme_Enabled_Name => Get(nameof(Theme_Enabled_Name));
|
||||
internal static string Theme_Enabled_Description => Get(nameof(Theme_Enabled_Description));
|
||||
internal static string Theme_WindowOpacity_Label => Get(nameof(Theme_WindowOpacity_Label));
|
||||
internal static string Theme_WindowOpacity_Help => Get(nameof(Theme_WindowOpacity_Help));
|
||||
}
|
||||
|
||||
@@ -273,4 +273,10 @@
|
||||
<data name="Theme_Enabled_Description" xml:space="preserve">
|
||||
<value>Industrielle HUD-Palette mit cyan-blauen Aktionsfarben, schiefer-violetten Tabs und Bernstein-Akzenten für aktive Zustände, global angewendet auf Chat-Fenster, Einstellungen, Viewer und Wizard. Deaktivieren, um das Standard-Dalamud-Erscheinungsbild zu nutzen.</value>
|
||||
</data>
|
||||
<data name="Theme_WindowOpacity_Label" xml:space="preserve">
|
||||
<value>Fenster-Deckkraft</value>
|
||||
</data>
|
||||
<data name="Theme_WindowOpacity_Help" xml:space="preserve">
|
||||
<value>Wie deckend die Plugin-Fenster sind. Niedrigere Werte lassen das Spiel durchscheinen, Form-Felder und Dialoge bleiben oben drauf deckend und gut lesbar.</value>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
@@ -273,4 +273,10 @@
|
||||
<data name="Theme_Enabled_Description" xml:space="preserve">
|
||||
<value>Industrial HUD palette with cyan-teal action accents, slate-violet tabs and amber active highlights, applied globally to chat log, settings, viewers and the wizard. Disable to fall back to the default Dalamud look.</value>
|
||||
</data>
|
||||
<data name="Theme_WindowOpacity_Label" xml:space="preserve">
|
||||
<value>Window opacity</value>
|
||||
</data>
|
||||
<data name="Theme_WindowOpacity_Help" xml:space="preserve">
|
||||
<value>How opaque the plugin panes are. Lower values let the game shine through; form fields and dialogs stay opaque on top so they remain readable.</value>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
@@ -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.5–1.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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user