mirror of
https://github.com/hykilpikonna/hyfetch.git
synced 2026-03-21 17:24:51 -05:00
[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
|
|
@ -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…
Reference in New Issue
Block a user