This is currently working:
lua Code:
--[[ Colors the border according to the current threat-situation
VOID UpdateThreat(FRAME self, EVENT event, UNIT unit)
]]
core.UpdateThreat = function(self, event, unit)
if (unit ~= self.unit) then return end
local status = UnitThreatSituation(unit)
if self.threatStatus == status then return end
if not status then status = 0 end
self.threatStatus = status
local r, g, b = unpack(settings.src.threatColors[status])
lib.SetBorderColor(self, r, g, b)
end
with
lua Code:
self.Threat = CreateFrame('Frame', self, nil)
self.Threat.Override = core.UpdateThreat
applied to the frame in question.
Here's SetBorderColor()
lua Code:
--[[ Apply a color to the border
VOID SetBorderColor(FRAME self, FLOAT r, FLOAT g, FLOAT b)
]]
lib.SetBorderColor = function(self, r, g, b)
if not self or type(self) ~= "table" then return end
local i
if not self.borderTextures then
lib.CreateBorder(self)
end
if not r then
r, g, b = 0.5, 0.5, 0.5
end
for i, tex in ipairs(self.borderTextures) do
tex:SetVertexColor(r, g, b)
end
end
and settings.src.threatColors
lua Code:
['threatColors'] = {
[0] = { 0.5, 0.5, 0.5 },
[1] = { 1, 1, 0 },
[2] = { 1, 1, 0 },
[3] = { 1, 0.3, 0.3 },
},