Skip to content

Commit 6f27b55

Browse files
committed
Better colour code conversion.
1 parent 726193e commit 6f27b55

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

LuaMenu/widgets/gui_planetwars_list_window.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ local DoUnMatchedActivityUpdate -- Activity update function
5050
-- Utilities
5151

5252
local function HexToColorString(hex)
53-
local r = string.format("%03d", tonumber(string.sub(hex, 2, 3) or "ff", 16))
54-
local g = string.format("%03d", tonumber(string.sub(hex, 4, 5) or "ff", 16))
55-
local b = string.format("%03d", tonumber(string.sub(hex, 6, 7) or "ff", 16))
56-
local postfunc, err = loadstring([[return "\255\]] .. r .. [[\]] .. g .. [[\]] .. b .. [["]])
57-
return postfunc()
53+
return Engine.textColorCodes.Color .. string.char(
54+
tonumber(hex:sub(2, 3), 16) or 255,
55+
tonumber(hex:sub(4, 5), 16) or 255,
56+
tonumber(hex:sub(6, 7), 16) or 255
57+
)
5858
end
5959

6060
local function HaveRightEngineVersion()

0 commit comments

Comments
 (0)