Format, lint, type

This commit is contained in:
Abel Luck 2022-12-01 14:20:37 +00:00
parent a1ae717c8f
commit c925079e8b
8 changed files with 159 additions and 91 deletions

View file

@ -14,8 +14,8 @@ def hex_to_rgb(color: str) -> RGB:
step = 1 if len(color) == 3 else 2
try:
r = int(color[0:step], 16)
g = int(color[step:2 * step], 16)
b = int(color[2 * step:3 * step], 16)
g = int(color[step : 2 * step], 16)
b = int(color[2 * step : 3 * step], 16)
except ValueError as e:
raise ValueError("Invalid hex value") from e
return r / 255, g / 255, b / 255
@ -59,4 +59,4 @@ def _linearize(v: float) -> float:
if v <= 0.03928:
return v / 12.92
else:
return ((v + 0.055) / 1.055) ** 2.4
return float(((v + 0.055) / 1.055) ** 2.4)