[F] Fix 3-length hex codes in Python when using custom preset (#443)
[F] Fix 3-length hex codes in Python
This commit is contained in:
@@ -141,9 +141,9 @@ class RGB:
|
|||||||
g = int(hex[2:4], 16)
|
g = int(hex[2:4], 16)
|
||||||
b = int(hex[4:6], 16)
|
b = int(hex[4:6], 16)
|
||||||
elif len(hex) == 3:
|
elif len(hex) == 3:
|
||||||
r = int(hex[0], 16)
|
r = int(hex[0] * 2, 16)
|
||||||
g = int(hex[1], 16)
|
g = int(hex[1] * 2, 16)
|
||||||
b = int(hex[2], 16)
|
b = int(hex[2] * 2, 16)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Error: invalid hex length")
|
raise ValueError(f"Error: invalid hex length")
|
||||||
return cls(r, g, b)
|
return cls(r, g, b)
|
||||||
|
|||||||
Reference in New Issue
Block a user