You need to double each single character so that #123 becomes #112233
youre doing: #123123 instead

A proper way to calculate that is:

hex_color = ''.join(x + y for x, y in zip(hex_color , hex_color))

My hex_to_rgba looks like this

def hex2rgba(x):
if len(x) < 6:
return tuple(17 * int(x[n+1], 16) * (1 if n < 3 else 1/255) for n in range(len(x) - 1))
else:
return tuple(int(x[2*n+1:2*n+3], 16) * (1 if n < 3 else 1/255) for n in range(len(x) // 2))

where I also receive the opacity if it was part of the string