Without derailing on how to modify Alza's UI my suggestion is just stop using CreateGB.
As Akryn said you should only create a texture once, reference and reuse it, it's that simple and here's an example for you.
Code:
local bg = Minimap:CreateTexture(nil, "BACKGROUND")
local offset = UIParent:GetScale() / Minimap:GetEffectiveScale()
bg:SetTexture(0, 0, 0, 1)
bg:SetPoint("BOTTOMRIGHT", offset, -offset)
bg:SetPoint("TOPLEFT", -offset, offset)
local f=CreateFrame("Frame")
f:SetScript("OnEvent", function(self, event, ...)
local inv = CalendarGetNumPendingInvites()
local mail = HasNewMail()
if inv > 0 and mail then -- New invites and mail
bg:SetTexture(1, .5, 0)
elseif inv > 0 and not mail then -- New invites and no mail
bg:SetTexture(1, 30/255, 60/255)
elseif inv==0 and mail then -- No invites and new mail
bg:SetTexture(0, 1, 0)
else -- Default color
bg:SetTexture(0, 0, 0)
end
end)
f:RegisterEvent("CALENDAR_UPDATE_PENDING_INVITES")
f:RegisterEvent("UPDATE_PENDING_MAIL")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
Now I only kept offset variable from the function because I don't know what your scale was, otherwise I'd probably just enter a single number like 1 or 2.