Set correct regex for rgba

This commit is contained in:
Kiryl
2022-09-21 20:08:33 +03:00
parent 8557e4879e
commit 5f0560fe59

View File

@@ -103,7 +103,7 @@ def str2hex(s: str) -> str:
return rgb_percent_to_hex((r, g, b))
if "rgb" in s.lower():
rgba = re.findall("([0-9] *\.?[0-9]+)", s)
rgba = re.findall("(\d+(?:\.\d+)?)", s)
r, g, b = int(rgba[0]), int(rgba[1]), int(rgba[2])
if len(rgba) == 4:
alpha = float(rgba[3])