From 41ffbbffb07ea52e2950adc97f03060f2f0f1ede Mon Sep 17 00:00:00 2001 From: Vati Date: Sun, 29 Mar 2026 19:42:47 +0400 Subject: [PATCH] fix: pfUI compatibility background color --- Core/Constants.lua | 5 +++++ Core/Database.lua | 2 +- Core/Theme.lua | 52 +++++++++++++++++++++++++++++++++++++++++--- Guda.toc | 1 + UI/SettingsPopup.lua | 2 +- 5 files changed, 57 insertions(+), 5 deletions(-) diff --git a/Core/Constants.lua b/Core/Constants.lua index 6123fd1..0633dcd 100644 --- a/Core/Constants.lua +++ b/Core/Constants.lua @@ -228,4 +228,9 @@ C.TOOLTIP = { MAX_MONEY_FRAMES = 8, -- Maximum number of money frames to search } +--============================================================================= +-- pfUI Theme Defaults +--============================================================================= +C.PFUI_DEFAULT_BG_TRANSPARENCY = 0.4 + addon:Debug("Constants module loaded") diff --git a/Core/Database.lua b/Core/Database.lua index 0f3024e..758897e 100644 --- a/Core/Database.lua +++ b/Core/Database.lua @@ -148,7 +148,7 @@ function DB:Initialize() if pfUI then Guda_CharDB.settings.theme = "pfui" Guda_CharDB.settings.hideBorders = true - Guda_CharDB.settings.bgTransparency = 0 + Guda_CharDB.settings.bgTransparency = Guda.Constants.PFUI_DEFAULT_BG_TRANSPARENCY Guda_CharDB.settings.iconSpacing = 8 end end diff --git a/Core/Theme.lua b/Core/Theme.lua index 7d7f649..b159d55 100644 --- a/Core/Theme.lua +++ b/Core/Theme.lua @@ -16,6 +16,27 @@ local function ThemeDebug(msg, a1, a2, a3, a4, a5, a6, a7) end end +-- Read a color from pfUI_config.appearance.border (e.g. "background" or "color") +-- pfUI stores colors as comma-separated strings: "R,G,B,A" +local function ParseColorString(str) + if not str then return nil end + local vals = {} + for v in string.gfind(str, "[^,]+") do + table.insert(vals, tonumber(v)) + end + if vals[1] then + return vals[1], vals[2], vals[3], vals[4] + end + return nil +end + +local function GetPfUIColor(key) + if pfUI_config and pfUI_config.appearance and pfUI_config.appearance.border then + return ParseColorString(pfUI_config.appearance.border[key]) + end + return nil +end + -- Theme definitions -- Background is rendered via a standalone Texture child (not bgFile). local themes = { @@ -124,7 +145,29 @@ function Theme:Get() return cachedTheme end cachedThemeName = name - cachedTheme = themes[name] or themes.guda + local base = themes[name] or themes.guda + + -- When pfUI theme is active and pfUI is loaded, inherit pfUI's colors + if name == "pfui" then + -- Shallow copy so we don't mutate the static theme table + local t = {} + for k, v in pairs(base) do t[k] = v end + + local br, bg, bb, ba = GetPfUIColor("background") + if br then + t.bgColor = { r = br, g = bg, b = bb } + t.footerButtonBg = { br, bg, bb, ba or 1 } + end + local er, eg, eb, ea = GetPfUIColor("color") + if er then + t.borderColor = { er, eg, eb, ea or 1 } + t.footerButtonBorder = { er, eg, eb, ea or 1 } + end + cachedTheme = t + else + cachedTheme = base + end + return cachedTheme end @@ -654,8 +697,11 @@ function Theme:ApplySearchBoxStyle() edgeSize = 1, insets = { left = -1, right = -1, top = -1, bottom = -1 }, }) - box:SetBackdropColor(0, 0, 0, 1) - box:SetBackdropBorderColor(0.2, 0.2, 0.2, 1) + local t = self:Get() + local sbg = t.bgColor + box:SetBackdropColor(sbg.r, sbg.g, sbg.b, 1) + local sbc = t.borderColor or { 0.2, 0.2, 0.2, 1 } + box:SetBackdropBorderColor(sbc[1], sbc[2], sbc[3], sbc[4]) -- Reposition flush left at x=10 box:ClearAllPoints() box:SetPoint("LEFT", box:GetParent(), "LEFT", 8, 0) diff --git a/Guda.toc b/Guda.toc index da01fcd..694ceb7 100644 --- a/Guda.toc +++ b/Guda.toc @@ -5,6 +5,7 @@ ## Version: 2.1.6 ## SavedVariables: Guda_DB ## SavedVariablesPerCharacter: Guda_CharDB +## OptionalDeps: pfUI Localization.lua diff --git a/UI/SettingsPopup.lua b/UI/SettingsPopup.lua index fbbfb0b..74e5975 100644 --- a/UI/SettingsPopup.lua +++ b/UI/SettingsPopup.lua @@ -1622,7 +1622,7 @@ function Guda_SettingsPopup_ApplyTheme(themeId) DB:SetSetting("_prePfui_hideBorders", DB:GetSetting("hideBorders")) DB:SetSetting("_prePfui_bgTransparency", DB:GetSetting("bgTransparency")) DB:SetSetting("hideBorders", true) - DB:SetSetting("bgTransparency", 0) + DB:SetSetting("bgTransparency", Guda.Constants.PFUI_DEFAULT_BG_TRANSPARENCY) end DB:SetSetting("theme", themeId)