addon/Addon/Code/Shared.lua

17 lines
504 B
Lua
Raw Normal View History

local _, addon = ...
local function ClearStringFormatMarks(text)
-- Remove colors (|cffffff...)
text = text:gsub("|c%x%x%x%x%x%x%x%x", "")
-- Remove H marks
text = text:gsub("|H.-|h", "")
return text
end
addon.API.ClearStringFormatMarks = ClearStringFormatMarks
local function ColorSpellNames(text, color)
return text:gsub("%[(.-)%]", function(match)
return string.format("|c%s[%s]|r", color or "FF0000FF", match)
end)
end
addon.API.ColorSpellNames = ColorSpellNames