diff --git a/EllesmereUIChat/EllesmereUIChat.lua b/EllesmereUIChat/EllesmereUIChat.lua index 17561a7ed..21d66390d 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 }, @@ -3965,6 +3966,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 269584d7b..a3830bcf3 100644 --- a/EllesmereUIChat/EllesmereUIChat_Tabs.lua +++ b/EllesmereUIChat/EllesmereUIChat_Tabs.lua @@ -88,6 +88,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) @@ -321,16 +329,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 1caa5d232..e103fe672 100644 --- a/EllesmereUIOptions/EUI_Chat_Options.lua +++ b/EllesmereUIOptions/EUI_Chat_Options.lua @@ -1073,6 +1073,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,