Sorry, we don't support your browser.  Install a modern browser
This post is closed.

Color.fromHex broken#1631

A lot of hex codes do not work when using the Color.fromHex function.
For example: Color.fromHex(“A26AE1”)

Someone actually shared this code from the old forums a while back to fix it:

function Color.fromHex(hexColor)
local rStr, gStr, bStr = hexColor:match(‘#?(%x%x)(%x%x)(%x%x)’)
assert(rStr and gStr and bStr, tostring(hexColor) .. ‘ is not a valid color hex string’)
return Color(tonumber(rStr, 16)/255, tonumber(gStr, 16)/255, tonumber(bStr, 16)/255)
end

2 years ago
Changed the status to
In Progress
2 years ago
Changed the status to
Completed
2 years ago