api: add and use rgbhex function

* A memoizing method to cache and return hex colorstrings from rgb input.
* Refactor all occurences of adhoc rgb to hex string concatenation to use the new method
* Refactor chat module to use it
This commit is contained in:
Road-block
2019-05-01 15:23:05 +02:00
committed by shagu
parent 0ea4d54f24
commit cf4c9ac361
8 changed files with 58 additions and 28 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ pfUI:RegisterModule("socialmod", function ()
local lcolor = GetDifficultyColor(tonumber(level)) or { 1, 1, 1 }
zone = ( zone == playerzone and "|cffffffff" or "|cffaaaaaa" ) .. zone .. "|r"
name = "|cff" .. string.format("%02x%02x%02x", ccolor.r*255, ccolor.g*255, ccolor.b*255) .. name .. "|r"
name = RgbHex(ccolor) .. name .. "|r"
_G["FriendsFrameFriendButton"..i..FRIENDS_NAME_LOCATION]:SetText(format(TEXT(FRIENDS_LIST_TEMPLATE), name, zone, status))
_G["FriendsFrameFriendButton"..i.."ButtonTextInfo"]:SetText(format(TEXT(FRIENDS_LEVEL_TEMPLATE), level, class))