summaryrefslogtreecommitdiff
path: root/pywal
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2018-06-26 07:31:47 +1000
committerDylan Araps <dylan.araps@gmail.com>2018-06-26 07:31:47 +1000
commitae79aba6e014071e931a04185b9cd455fb8ae72b (patch)
tree0b3262c333e93c256756c62b233bfcf9ed42cce2 /pywal
parentd49caeebfb9d76a4baa653cc9a8d143005d44688 (diff)
colors: Revert palette changes. Fixes #266
Diffstat (limited to 'pywal')
-rw-r--r--pywal/backends/wal.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/pywal/backends/wal.py b/pywal/backends/wal.py
index 9d717b5..1a85e17 100644
--- a/pywal/backends/wal.py
+++ b/pywal/backends/wal.py
@@ -35,12 +35,21 @@ def has_im():
def gen_colors(img):
"""Format the output from imagemagick into a list
of hex colors."""
- raw_colors = imagemagick(20, img, has_im())
+ magick_command = has_im()
- if len(raw_colors) < 16:
- logging.error("Imagemagick couldn't generate a palette.")
- logging.error("Try a different image or backend.")
- sys.exit(1)
+ for i in range(0, 20, 1):
+ raw_colors = imagemagick(16 + i, img, magick_command)
+
+ if len(raw_colors) > 16:
+ break
+
+ elif i == 19:
+ logging.error("Imagemagick couldn't generate a suitable palette.")
+ sys.exit(1)
+
+ else:
+ logging.warning("Imagemagick couldn't generate a palette.")
+ logging.warning("Trying a larger palette size %s", 16 + i)
return [re.search("#.{6}", str(col)).group(0) for col in raw_colors[1:]]