Replace fix with a more idiomatic version

This was suggested by @UmarJ. Thanks!
pull/315/head
Gerben Welter 2021-06-07 08:42:30 +02:00
parent 2002d8049b
commit 83bbfcff1b
1 changed files with 2 additions and 3 deletions

View File

@ -1141,9 +1141,8 @@ class Color:
else:
raise ValueError(f'RGB dec should be "0-255 0-255 0-255"')
for i in [0, 1, 2]:
if not (0 <= self.dec[i] <= 255):
raise ValueError(f'One or more RGB values are out of range: {color}')
if not all(0 <= c <= 255 for c in self.dec):
raise ValueError(f'One or more RGB values are out of range: {color}')
except Exception as e:
errlog.exception(str(e))