[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:
parent
c722c73e79
commit
f5c5e31691
1 changed files with 3 additions and 3 deletions
|
|
@ -141,9 +141,9 @@ class RGB:
|
|||
g = int(hex[2:4], 16)
|
||||
b = int(hex[4:6], 16)
|
||||
elif len(hex) == 3:
|
||||
r = int(hex[0], 16)
|
||||
g = int(hex[1], 16)
|
||||
b = int(hex[2], 16)
|
||||
r = int(hex[0] * 2, 16)
|
||||
g = int(hex[1] * 2, 16)
|
||||
b = int(hex[2] * 2, 16)
|
||||
else:
|
||||
raise ValueError(f"Error: invalid hex length")
|
||||
return cls(r, g, b)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue