addon/Addon/Code/Shared.lua
Roman Jaroš f37808207e
All checks were successful
forgejo/Czech Quests/addon/pipeline/head This commit looks good
Refactor and improve encounter data handling and formatting
2025-04-19 00:42:06 +02:00

17 lines
No EOL
504 B
Lua

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