Allright, there's something that's bothering me now.
Say i use the following tag instead on the Hex() funtion
Code:
oUF.Tags['[gradient]'] = function(unit)
local min, max = UnitHealth(unit), UnitHealthMax(unit)
r, g, b = oUF.ColorGradient(min / max, 0.69, 0.31, 0.31, 0.65, 0.63, 0.35, 0.33, 0.59, 0.33)
return string.format('|cff%02x%02x%02x', r*255, g*255, b*255)
end
And then, here's an example of what you can find in my health tag
Code:
return (max > min) and '|cffaf5050'..oUF.Tags['[curhp]'](unit)..'|r'..'|cffD7BEA5 - |r'..oUF.Tags['[perhp]'](unit)..'%|r'
Then finally
Code:
self:Tag(self.hvalue, '[gradient][health]')
the first part of my health line above is [curhp] but i'm giving it a custom fixed color, then there's the - and finally [perhp] which is without any custom coloring
So i'm assuming [perhp] will get the [gradient], but it doesn't, why ?
Whenever i manually set the color of something nothing that comes after that will get the gradient, even if i payed close attention to close everything with |r as suggested.
EDIT: Also, this code does a memory leak in the layout, making it go up to 1+meg in raids.
Code:
function PostUpdateAuraIcon(self, icons, unit, icon, index, offset, filter, isDebuff)
icon:SetScript('OnMouseUp', function(self, mouseButton)
if(mouseButton == 'RightButton' and not isDebuff and unit == 'player') then
CancelUnitBuff('player', index)
end
end)
end
This is the only efficient way i've found to have a flawlessly working right click buffs cancelling. If i move it to the PostCreateAuraIcon and use button instead of icon then i can't check for unit == 'player' and ofc i can then cancel my own buffs by clicking on any frame.
Does anyone know a workaround, a way to have it working without memory leak ?