I use these code to make debuff (not casted by me) desaturated, but sometimes some buff desaturated too, any idea?
Lua Code:
local PostUpdateIcon = function(_, unit, icon, index, _, filter)
local _, _, _, _, dtype = UnitAura(unit, index, icon.filter)
local texture = icon.icon
if icon.isDebuff and dtype and UnitIsFriend("player", unit) then
local color = DebuffTypeColor[dtype]
icon.bg:SetVertexColor(color.r, color.g, color.b)
else
icon.bg:SetVertexColor(0, 0, 0)
end
if icon.isDebuff and not icon.isPlayer then
texture:SetDesaturated(true)
else
texture:SetDesaturated(false)
end
end