首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我怎样才能在文字上加上颜色呢?

我怎样才能在文字上加上颜色呢?
EN

Stack Overflow用户
提问于 2021-03-15 01:37:01
回答 1查看 2K关注 0票数 0
代码语言:javascript
复制
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")

我正在为“魔兽世界”作一个评论,我想知道如何改变印刷字母的颜色。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-03-15 07:15:01

尝尝这个。如果在一分钟内通过网络搜索找到的话.

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

代码语言:javascript
复制
colors = {
    {
        title = 'LIGHTBLUE',
        color = 'cff00ccff',
    }, -- and many more
}
function printColors()
    --print("\124cffFF0000This text is red\124r") --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)

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66631319

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档