fix: strengthen unusable item tint

This commit is contained in:
Dusk-92
2026-09-05 21:42:47 +02:00
parent 9cb9fa513f
commit 2ff7cea917
+13 -13
View File
@@ -10,31 +10,31 @@ local OriginalSetItem = Guda_ItemButton_SetItem
local function EnsureUnusableOverlay(button) local function EnsureUnusableOverlay(button)
if button.unusableOverlay then return button.unusableOverlay end if button.unusableOverlay then return button.unusableOverlay end
local overlay = button:CreateTexture(nil, "OVERLAY") local icon = getglobal(button:GetName().."IconTexture") or getglobal(button:GetName().."Icon") or button.icon or button.Icon
overlay:SetAllPoints(button) local overlay = (icon and icon:GetParent() or button):CreateTexture(nil, "OVERLAY")
overlay:SetAllPoints(icon or button)
overlay:SetTexture("Interface\\ChatFrame\\ChatFrameBackground") overlay:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
overlay:Hide() overlay:Hide()
button.unusableOverlay = overlay button.unusableOverlay = overlay
return overlay return overlay
end end
-- Mirror ItemButton.lua's unusable color selection exactly. The original helper -- Keep the same color selection as ItemButton.lua, but use a stronger overlay
-- is local to ItemButton.lua, so this safety layer cannot call it directly. -- so unusable recipes/equipment remain clearly red after sorting and redraws.
local function GetUnusableColor() local function GetUnusableColor()
if pfUI and C and C.appearance and C.appearance.bags and C.appearance.bags.unusable_color then if pfUI and C and C.appearance and C.appearance.bags and C.appearance.bags.unusable_color then
local cr, cg, cb, ca = strsplit(",", C.appearance.bags.unusable_color) local cr, cg, cb = strsplit(",", C.appearance.bags.unusable_color)
local r = tonumber(cr) or 0.9 local r = tonumber(cr) or 0.9
local g = tonumber(cg) or 0.2 local g = tonumber(cg) or 0.2
local b = tonumber(cb) or 0.2 local b = tonumber(cb) or 0.2
local a = tonumber(ca) or 1.0 return r, g, b
return r, g, b, a
end end
if RED_FONT_COLOR then if RED_FONT_COLOR then
return RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, 1.0 return RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b
end end
return 0.9, 0.2, 0.2, 1.0 return 0.9, 0.2, 0.2
end end
local function ApplyUnusableTint(button, unusable) local function ApplyUnusableTint(button, unusable)
@@ -54,10 +54,10 @@ local function ApplyUnusableTint(button, unusable)
overlay = EnsureUnusableOverlay(button) overlay = EnsureUnusableOverlay(button)
local r, g, b, a = GetUnusableColor() local r, g, b = GetUnusableColor()
-- Match ItemButton.lua exactly: configured alpha is reduced once by 45%. -- Deliberately stronger than Guda's original 45% overlay. At 70% the
local alpha = (a or 1.0) * 0.45 -- unusable state stays obvious on bright recipe icons after restack/sort.
overlay:SetVertexColor(r or 0.9, g or 0.2, b or 0.2, alpha) overlay:SetVertexColor(r or 0.9, g or 0.2, b or 0.2, 0.70)
overlay:Show() overlay:Show()
end end