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
@@ -53,7 +53,7 @@ local getFontString = function(obj)
segment = segment and segment ~= "" and segment or nil
if segment then
r, g, b, a = left:GetTextColor()
segment = "|c" .. string.format("ff%02x%02x%02x", r*255, g*255, b*255) .. segment .. "|r"
segment = rgbhex(r,g,b) .. segment .. "|r"
text = text and text .. "\n" .. segment or segment
end
end