[F] Fix 3-length hex codes in Python

This commit is contained in:
thea 2025-10-10 13:50:13 +10:00
parent c722c73e79
commit 66097b1c02
No known key found for this signature in database

View File

@ -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)