revert: restore previous unusable tint behavior

This commit is contained in:
Dusk-92
2026-09-05 22:15:52 +02:00
parent 2ff7cea917
commit 2114a0bd17
+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 icon = getglobal(button:GetName().."IconTexture") or getglobal(button:GetName().."Icon") or button.icon or button.Icon local overlay = button:CreateTexture(nil, "OVERLAY")
local overlay = (icon and icon:GetParent() or button):CreateTexture(nil, "OVERLAY") overlay:SetAllPoints(button)
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
-- Keep the same color selection as ItemButton.lua, but use a stronger overlay -- Mirror ItemButton.lua's unusable color selection exactly. The original helper
-- so unusable recipes/equipment remain clearly red after sorting and redraws. -- is local to ItemButton.lua, so this safety layer cannot call it directly.
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 = strsplit(",", C.appearance.bags.unusable_color) local cr, cg, cb, ca = 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
return r, g, b local a = tonumber(ca) or 1.0
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 return RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, 1.0
end end
return 0.9, 0.2, 0.2 return 0.9, 0.2, 0.2, 1.0
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 = GetUnusableColor() local r, g, b, a = GetUnusableColor()
-- Deliberately stronger than Guda's original 45% overlay. At 70% the -- Match ItemButton.lua exactly: configured alpha is reduced once by 45%.
-- unusable state stays obvious on bright recipe icons after restack/sort. local alpha = (a or 1.0) * 0.45
overlay:SetVertexColor(r or 0.9, g or 0.2, b or 0.2, 0.70) overlay:SetVertexColor(r or 0.9, g or 0.2, b or 0.2, alpha)
overlay:Show() overlay:Show()
end end