From 3497ba69265c19b7c9c93a18e57b8aa2cd0a8bb9 Mon Sep 17 00:00:00 2001 From: "vjekoslav.krenek@gmail.com" Date: Thu, 10 Sep 2026 16:05:39 +0200 Subject: [PATCH] Fix: Chat Tabs have setting that does nothing/gets overridden Bug: Issue: right-clicking a chat tab and setting Background Color does nothing visually. EUI's chat skin hides Blizzard's entire native chat background (cf.Background:SetAlpha(0), every native region zeroed) and draws its own separate panel instead, so the native color picker has nothing left to render onto. Fix: added an opt-in toggle under the Tabs section ("Use Tab's Background Color", off by default): when on, each tab's own background (EUI's existing tabBackgroundColor/tabBackgroundColorActive) reads that window's native color (GetChatWindowInfo, normalizing its legacy 0-255 range) instead of the shared swatches, keeping each state's own opacity. A hooksecurefunc on SetChatWindowColor re-applies it live via ApplyTabAppearance the moment the native picker is used. Temporary/whisper tabs (no real window id) always keep EUI's own color. Existing behavior unchanged when the toggle stays off. --- EllesmereUIChat/EllesmereUIChat.lua | 10 ++++++++++ EllesmereUIChat/EllesmereUIChat_Tabs.lua | 20 ++++++++++++++++++-- EllesmereUIOptions/EUI_Chat_Options.lua | 11 +++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/EllesmereUIChat/EllesmereUIChat.lua b/EllesmereUIChat/EllesmereUIChat.lua index bb6cebe21..739ab205a 100644 --- a/EllesmereUIChat/EllesmereUIChat.lua +++ b/EllesmereUIChat/EllesmereUIChat.lua @@ -113,6 +113,7 @@ local CHAT_DEFAULTS = { scrollButtonOnChat = false, tabBackgroundColor = { r=0.03, g=0.045, b=0.05, a=0.44 }, tabBackgroundColorActive = { r=0.03, g=0.045, b=0.05, a=0.65 }, + tabUseNativeBgColor = false, -- follow each window's own right-click Background Color activeUnderline = true, activeUnderlineColorMode = "accent", activeUnderlineColor = { r=0.05, g=0.82, b=0.61, a=1 }, @@ -3887,6 +3888,15 @@ hooksecurefunc("SetItemRef", function(link) end end) +-- Live-follow a tab's right-click Background Color when tabUseNativeBgColor is +-- on; no-op (cheap) otherwise. +hooksecurefunc("SetChatWindowColor", function() + local p = ECHAT.DB() + if p and p.tabUseNativeBgColor and ECHAT.ApplyTabAppearance then + ECHAT.ApplyTabAppearance() + end +end) + ------------------------------------------------------------------------------- -- Chat frame reskin ------------------------------------------------------------------------------- diff --git a/EllesmereUIChat/EllesmereUIChat_Tabs.lua b/EllesmereUIChat/EllesmereUIChat_Tabs.lua index c8e94bd17..e52ebba85 100644 --- a/EllesmereUIChat/EllesmereUIChat_Tabs.lua +++ b/EllesmereUIChat/EllesmereUIChat_Tabs.lua @@ -80,6 +80,14 @@ local function ResolveModeColor(mode, stored, fallback) return c.r or 1, c.g or 1, c.b or 1, a end +-- Reads the window's own right-click Background Color; normalizes 0-255 (legacy API range) to 0-1. +local function ResolveNativeTabColor(id) + local ok, _, _, r, g, b = pcall(GetChatWindowInfo, id) + if not ok or not r then return nil end + if r > 1 or g > 1 or b > 1 then r, g, b = r / 255, g / 255, b / 255 end + return r, g, b +end + local function SelectedWindow() return GENERAL_CHAT_DOCK and FCFDock_GetSelectedWindow and FCFDock_GetSelectedWindow(GENERAL_CHAT_DOCK) @@ -310,16 +318,24 @@ local function StyleGhost(g, isActive) -- The alert glow wears the tab's text color (desaturated art + tint). g._glow:SetVertexColor(tr, tg, tb) - -- Background: color or texture, active/inactive variants. + -- Background: color or texture, active/inactive variants. Native mode keeps + -- each state's own opacity but swaps in the window's right-click color. + local nr, ng, nb + if cfg.tabUseNativeBgColor and state.id and not state.isTemp then + nr, ng, nb = ResolveNativeTabColor(state.id) + end local bgc if isActive then local stored = cfg.tabBackgroundColorActive or { r = .03, g = .045, b = .05, a = .65 } local br, bgc2, bb, ba = ResolveModeColor(cfg.tabBackgroundColorActiveMode or "custom", stored, { r = .03, g = .045, b = .05, a = .65 }) + if nr then br, bgc2, bb = nr, ng, nb end bgc = { r = br, g = bgc2, b = bb, a = ba } else local c = cfg.tabBackgroundColor or { r = .03, g = .045, b = .05, a = .44 } - bgc = { r = c.r or .03, g = c.g or .045, b = c.b or .05, a = c.a == nil and .44 or c.a } + local br, bgc2, bb, ba = c.r or .03, c.g or .045, c.b or .05, (c.a == nil and .44 or c.a) + if nr then br, bgc2, bb = nr, ng, nb end + bgc = { r = br, g = bgc2, b = bb, a = ba } end local texKey = cfg.tabBackgroundTexture or "none" local texPath diff --git a/EllesmereUIOptions/EUI_Chat_Options.lua b/EllesmereUIOptions/EUI_Chat_Options.lua index a357279b1..0c5b2f3ff 100644 --- a/EllesmereUIOptions/EUI_Chat_Options.lua +++ b/EllesmereUIOptions/EUI_Chat_Options.lua @@ -1069,6 +1069,17 @@ initFrame:SetScript("OnEvent", function(self) end y = y - h + _, h = W:DualRow(parent, y, + { type="toggle", text="Use Tab's Background Color", + tooltip="Follow each chat window's own right-click > Background Color instead of the swatches above.", + getValue=function() return Cfg("tabUseNativeBgColor") or false end, + setValue=function(v) + Set("tabUseNativeBgColor", v) + if ECHAT.ApplyTabAppearance then ECHAT.ApplyTabAppearance() end + end }, + { type="label", text="" }) + y = y - h + local function UnderlineMode() local mode = Cfg("activeUnderlineColorMode") or "accent" -- Legacy "border" profiles render and display as Custom,