Compare with Previous | Blame | View Log
local colorTable = setmetatable( {}, {__index = function(self, val) local r, g, b = GetItemQualityColor(val) rawset(self, val, {r, g, b}) return self[val] end} ) local createBorder = function(self, point) local bc = self.oGlowBorder if not bc then if not self:IsObjectType("Frame") then bc = CreateFrame("Frame", nil, self:GetParent()) else bc = CreateFrame("Frame", nil, self) end bc:SetBackdrop({ bgFile = "", edgeFile = "Interface\\AddOns\\QulightUI\\Root\\Media\\glowTex", edgeSize = 3, insets = { left = 3, right = 3, top = 3, bottom = 3 } }) if self.backdrop then bc:SetPoint("TOPLEFT", 2, 0) bc:SetPoint("BOTTOMRIGHT", 0, 0) else bc:SetPoint("TOPLEFT", point or self, -2, 2) bc:SetPoint("BOTTOMRIGHT", point or self, 2, -2) end self.oGlowBorder = bc end return bc end local borderDisplay = function(frame, color) if color then local bc = createBorder(frame) local rgb = colorTable[color] if rgb then bc:SetBackdropBorderColor(rgb[1], rgb[2], rgb[3]) if bc.backdrop then bc.backdrop:SetBackdropBorderColor(rgb[1], rgb[2], rgb[3]) end bc:Show() end return true elseif frame.oGlowBorder then frame.oGlowBorder:Hide() end end function oGlow:RegisterColor(name, r, g, b) if(rawget(colorTable, name)) then return nil, string.format("Color [%s] is already registered.", name) else rawset(colorTable, name, {r, g, b}) end return true end oGlow:RegisterDisplay("Border", borderDisplay)