如何在lua中为文本添加颜色


currentHead, maximumHead= GetInventoryItemDurability(1);
currentShoulder, maximumShoulder = GetInventoryItemDurability(3);
currentChest, maximumChest = GetInventoryItemDurability(5);
print("Head: " .. currentHead .. " Durability")
print("Shoulders: " .. currentShoulder .. " Durability")
print("Chest: " .. currentChest .. "/" .. maximumChest .. " Durability")

我正在为魔兽世界制作一个插件,我想知道如何更改打印中字母的颜色

试试这个。如果在一分钟左右的时间内通过网络搜索找到它…

https://www.wowinterface.com/forums/showthread.php?t=25712

colors = {
{
title = 'LIGHTBLUE',
color = 'cff00ccff',
}, -- and many more
}
function printColors()
--print("124cffFF0000This text is red124r") --This is red color
local startLine = '124'
local endLine = '124r'
for i = 1, table.getn(colors) do
print(startLine .. colors[i].color .. colors[i].title .. endLine)
end
end

根据https://wow.gamepedia.com/UI_escape_sequences

您也可以使用WrapTextInColorCode(text, colorCode)

相关内容

  • 没有找到相关文章

最新更新