mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-06-19 17:19:08 +02:00
Fixed wal backend generating only 9 colors
This commit is contained in:
parent
e504c55e70
commit
2e04b0fdf3
@ -12,8 +12,8 @@ except ImportError:
|
||||
logging.error("Try another backend. (wal --backend)")
|
||||
sys.exit(1)
|
||||
|
||||
from .. import util
|
||||
from .. import colors
|
||||
from .. import util
|
||||
|
||||
|
||||
def gen_colors(img):
|
||||
@ -26,7 +26,7 @@ def gen_colors(img):
|
||||
if len(raw_colors) >= 8:
|
||||
break
|
||||
|
||||
elif i == 10:
|
||||
if i == 10:
|
||||
logging.error("ColorThief couldn't generate a suitable palette.")
|
||||
sys.exit(1)
|
||||
|
||||
|
@ -7,8 +7,8 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from .. import util
|
||||
from .. import colors
|
||||
from .. import util
|
||||
|
||||
|
||||
def imagemagick(color_count, img, magick_command):
|
||||
@ -44,7 +44,7 @@ def gen_colors(img):
|
||||
if len(raw_colors) > 16:
|
||||
break
|
||||
|
||||
elif i == 19:
|
||||
if i == 19:
|
||||
logging.error("Imagemagick couldn't generate a suitable palette.")
|
||||
sys.exit(1)
|
||||
|
||||
|
@ -71,12 +71,12 @@ def generic_adjust(colors, light):
|
||||
colors[0] = util.lighten_color(colors[0], 0.75)
|
||||
colors[7] = util.darken_color(colors[0], 0.50)
|
||||
colors[8] = util.darken_color(colors[0], 0.25)
|
||||
colors[1] = util.darken_color(colors[9], 0.25)
|
||||
colors[2] = util.darken_color(colors[10], 0.25)
|
||||
colors[3] = util.darken_color(colors[11], 0.25)
|
||||
colors[4] = util.darken_color(colors[12], 0.25)
|
||||
colors[5] = util.darken_color(colors[13], 0.25)
|
||||
colors[6] = util.darken_color(colors[14], 0.25)
|
||||
colors[1] = util.darken_color(colors[1], 0.25)
|
||||
colors[2] = util.darken_color(colors[2], 0.25)
|
||||
colors[3] = util.darken_color(colors[3], 0.25)
|
||||
colors[4] = util.darken_color(colors[4], 0.25)
|
||||
colors[5] = util.darken_color(colors[5], 0.25)
|
||||
colors[6] = util.darken_color(colors[6], 0.25)
|
||||
colors[15] = util.darken_color(colors[0], 0.75)
|
||||
|
||||
else:
|
||||
@ -84,12 +84,12 @@ def generic_adjust(colors, light):
|
||||
colors[0] = util.darken_color(colors[0], 0.75)
|
||||
colors[7] = util.lighten_color(colors[0], 0.50)
|
||||
colors[8] = util.lighten_color(colors[0], 0.25)
|
||||
colors[1] = util.darken_color(colors[9], 0.25)
|
||||
colors[2] = util.darken_color(colors[10], 0.25)
|
||||
colors[3] = util.darken_color(colors[11], 0.25)
|
||||
colors[4] = util.darken_color(colors[12], 0.25)
|
||||
colors[5] = util.darken_color(colors[13], 0.25)
|
||||
colors[6] = util.darken_color(colors[14], 0.25)
|
||||
colors[1] = util.darken_color(colors[1], 0.25)
|
||||
colors[2] = util.darken_color(colors[2], 0.25)
|
||||
colors[3] = util.darken_color(colors[3], 0.25)
|
||||
colors[4] = util.darken_color(colors[4], 0.25)
|
||||
colors[5] = util.darken_color(colors[5], 0.25)
|
||||
colors[6] = util.darken_color(colors[6], 0.25)
|
||||
colors[15] = util.lighten_color(colors[0], 0.75)
|
||||
|
||||
|
||||
@ -110,9 +110,11 @@ def cache_fname(img, backend, light, cache_dir, sat=""):
|
||||
"""Create the cache file name."""
|
||||
color_type = "light" if light else "dark"
|
||||
file_name = re.sub("[/|\\|.]", "_", img)
|
||||
file_size = os.path.getsize(img)
|
||||
|
||||
file_parts = [file_name, color_type, backend, sat, __cache_version__]
|
||||
return [cache_dir, "schemes", "%s_%s_%s_%s_%s.json" % (*file_parts,)]
|
||||
file_parts = [file_name, color_type, backend,
|
||||
sat, file_size, __cache_version__]
|
||||
return [cache_dir, "schemes", "%s_%s_%s_%s_%s_%s.json" % (*file_parts,)]
|
||||
|
||||
|
||||
def get_backend(backend):
|
||||
|
Loading…
x
Reference in New Issue
Block a user