mirror of
https://github.com/dylanaraps/pywal.git
synced 2024-11-29 03:13:47 +01:00
colors: More readable loop
This commit is contained in:
parent
7984fd40af
commit
3fc3b5e033
@ -36,22 +36,22 @@ def gen_colors(img, color_count):
|
||||
"error: wal requires imagemagick to function.")
|
||||
sys.exit(1)
|
||||
|
||||
raw_colors = imagemagick(color_count, img, magick_command)
|
||||
|
||||
index = 0
|
||||
while len(raw_colors) - 1 < color_count:
|
||||
index += 1
|
||||
for index in range(0, 20, 1):
|
||||
raw_colors = imagemagick(color_count + index, img, magick_command)
|
||||
|
||||
print("colors: Imagemagick couldn't generate a", color_count,
|
||||
"color palette, trying a larger palette size",
|
||||
color_count + index)
|
||||
if len(raw_colors) > 16:
|
||||
break
|
||||
|
||||
if index > 20:
|
||||
elif index == 20:
|
||||
print("colors: Imagemagick couldn't generate a suitable scheme",
|
||||
"for the image. Exiting...")
|
||||
sys.exit(1)
|
||||
|
||||
else:
|
||||
print("colors: Imagemagick couldn't generate a", color_count,
|
||||
"color palette, trying a larger palette size",
|
||||
color_count + index)
|
||||
|
||||
# Remove the first element because it isn't a color code.
|
||||
del raw_colors[0]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user