Good morning/afternoon/night! I'm making a program right now and I ran into one problem. This program should create QR code from given text and should change its color to given color in RGB or HEX. But when I've made HEX color code to RGB "interpreter"... Well , you can see this problem: input - 61c3ff and output should show me something like R = 61 TO decimal (97), G = c3 TO decimal (195) and B = ff TO decimal (255). But in output I can only see that R = 6, G = 12, B = 15. What the hell? Here is a part from my code, which must recognize which one color code is given: RGB or HEX and must "translate" HEX to RGB (For example, {#}9effec in RGB will be 158 255 236).
for i in color:
if i == " ":
color = color.split()
x = color[0]
y = color[1]
z = color[2]
else: # If HEX color
if color[0] == "#": # if it starts with "#"
color = color[1:]
decX = color[0:1]
decY = color[2:3]
decZ = color[4:5]
x = int(decX, 16)
y = int(decY, 16)
z = int(decZ, 16)
print(color, x, y, z)
else: # if it's without "#"
decX = color[0:1]
decY = color[2:3]
decZ = color[4:5]
x = int(decX, 16)
y = int(decY, 16)
z = int(decZ, 16)
print(color, x, y, z)
If you need full code - https://pastebin.com/yCgK2KwU