How did you created the arror? (is it a texture, what is its parent frame and what events are registered to the frame?)
You have 2 options: creating an element as an oUF module and registering the proper events so it updates correctly, or just do it directly in the layout. This is what I currently use for threat, maybe it helps you a bit
create the element and expose it to the namespace
lua Code:
local AddThreatHighlight = function(self, event, unit)
if (unit ~= self.unit) then return end
local status = UnitThreatSituation(unit)
if (status and status > 0) then
local r, g, b = GetThreatStatusColor(status)
self.FrameBackdrop:SetBackdropBorderColor(r, g, b)
else
self.FrameBackdrop:SetBackdropBorderColor(0, 0, 0)
end
end
ns.AddThreatHighlight = AddThreatHighlight
enable it for the frame:
lua Code:
self:RegisterEvent("UNIT_THREAT_SITUATION_UPDATE", ns.AddThreatHighlight)
I'm unsure if an element as a module has any benefits.
And if you plan to release your layout, you should use metatables for the colors and not overwrite the oUF dafault table, in case a user wants to use a diffenrent layout for say raid frames or so.
lua Code:
ns.colors = setmetatable({
power = setmetatable({
['MANA'] = {0.0, 0.56, 1.0},
['RAGE'] = {1.0,0,0},
['FOCUS'] = {1.0,0.75,0.25},
['ENERGY'] = {1.0, 0.9, 0.35},
['RUNIC_POWER'] = {0.44,0.44,0.44},
}, {__index = oUF.colors.power}),
}, {__index = oUF.colors})