05.04.2023, 12:38
You can do it this way:
Your original function should work if color values are in the 0..255 range. But the output value width will vary unless the format is changed to %06x.
Code:
function rgbToHex(r,g,b)
return string.format('%02x%02x%02x', r, g, b)
end
Your original function should work if color values are in the 0..255 range. But the output value width will vary unless the format is changed to %06x.