From e504c55e70fca7fff4a98bc0c6e460832d9d2662 Mon Sep 17 00:00:00 2001 From: Todd Sonjiku Date: Mon, 3 May 2021 08:31:25 +0300 Subject: [PATCH 01/10] Made all backend scripts, use the newly modified adjust function from colors.py, that makes pywal generate darker shades for 1-7 --- pywal/backends/colorthief.py | 19 +++---------------- pywal/backends/wal.py | 28 +++++----------------------- pywal/colors.py | 33 +++++++++++++++++++++++---------- 3 files changed, 31 insertions(+), 49 deletions(-) diff --git a/pywal/backends/colorthief.py b/pywal/backends/colorthief.py index aae5bd0f..961b120a 100644 --- a/pywal/backends/colorthief.py +++ b/pywal/backends/colorthief.py @@ -13,6 +13,7 @@ sys.exit(1) from .. import util +from .. import colors def gen_colors(img): @@ -25,7 +26,7 @@ def gen_colors(img): if len(raw_colors) >= 8: break - if i == 10: + elif i == 10: logging.error("ColorThief couldn't generate a suitable palette.") sys.exit(1) @@ -41,21 +42,7 @@ def adjust(cols, light): cols.sort(key=util.rgb_to_yiq) raw_colors = [*cols, *cols] - if light: - raw_colors[0] = util.lighten_color(cols[0], 0.90) - raw_colors[7] = util.darken_color(cols[0], 0.75) - - else: - for color in raw_colors: - color = util.lighten_color(color, 0.40) - - raw_colors[0] = util.darken_color(cols[0], 0.80) - raw_colors[7] = util.lighten_color(cols[0], 0.60) - - raw_colors[8] = util.lighten_color(cols[0], 0.20) - raw_colors[15] = raw_colors[7] - - return raw_colors + return colors.generic_adjust(raw_colors, light) def get(img, light=False): diff --git a/pywal/backends/wal.py b/pywal/backends/wal.py index f05db41c..521747c4 100644 --- a/pywal/backends/wal.py +++ b/pywal/backends/wal.py @@ -8,6 +8,7 @@ import sys from .. import util +from .. import colors def imagemagick(color_count, img, magick_command): @@ -43,7 +44,7 @@ def gen_colors(img): if len(raw_colors) > 16: break - if i == 19: + elif i == 19: logging.error("Imagemagick couldn't generate a suitable palette.") sys.exit(1) @@ -54,31 +55,12 @@ def gen_colors(img): return [re.search("#.{6}", str(col)).group(0) for col in raw_colors[1:]] -def adjust(colors, light): +def adjust(cols, light): """Adjust the generated colors and store them in a dict that we will later save in json format.""" - raw_colors = colors[:1] + colors[8:16] + colors[8:-1] + raw_colors = cols[:1] + cols[8:16] + cols[8:-1] - # Manually adjust colors. - if light: - for color in raw_colors: - color = util.saturate_color(color, 0.5) - - raw_colors[0] = util.lighten_color(colors[-1], 0.85) - raw_colors[7] = colors[0] - raw_colors[8] = util.darken_color(colors[-1], 0.4) - raw_colors[15] = colors[0] - - else: - # Darken the background color slightly. - if raw_colors[0][1] != "0": - raw_colors[0] = util.darken_color(raw_colors[0], 0.40) - - raw_colors[7] = util.blend_color(raw_colors[7], "#EEEEEE") - raw_colors[8] = util.darken_color(raw_colors[7], 0.30) - raw_colors[15] = util.blend_color(raw_colors[15], "#EEEEEE") - - return raw_colors + return colors.generic_adjust(raw_colors, light) def get(img, light=False): diff --git a/pywal/colors.py b/pywal/colors.py index fd8033f8..fd2c68b6 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -67,16 +67,31 @@ def generic_adjust(colors, light): color = util.saturate_color(color, 0.60) color = util.darken_color(color, 0.5) - colors[0] = util.lighten_color(colors[0], 0.95) - colors[7] = util.darken_color(colors[0], 0.75) + + 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[15] = colors[7] + 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[15] = util.darken_color(colors[0], 0.75) else: - colors[0] = util.darken_color(colors[0], 0.80) - colors[7] = util.lighten_color(colors[0], 0.75) + + 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[15] = colors[7] + 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[15] = util.lighten_color(colors[0], 0.75) + return colors @@ -95,11 +110,9 @@ 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, file_size, __cache_version__] - return [cache_dir, "schemes", "%s_%s_%s_%s_%s_%s.json" % (*file_parts,)] + file_parts = [file_name, color_type, backend, sat, __cache_version__] + return [cache_dir, "schemes", "%s_%s_%s_%s_%s.json" % (*file_parts,)] def get_backend(backend): From 2e04b0fdf338c6837d37d76a4a2049bfd0552849 Mon Sep 17 00:00:00 2001 From: Todd Sonjiku Date: Wed, 19 May 2021 13:52:38 +0300 Subject: [PATCH 02/10] Fixed wal backend generating only 9 colors --- pywal/backends/colorthief.py | 4 ++-- pywal/backends/wal.py | 4 ++-- pywal/colors.py | 30 ++++++++++++++++-------------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/pywal/backends/colorthief.py b/pywal/backends/colorthief.py index 961b120a..1189b511 100644 --- a/pywal/backends/colorthief.py +++ b/pywal/backends/colorthief.py @@ -12,8 +12,8 @@ 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) diff --git a/pywal/backends/wal.py b/pywal/backends/wal.py index 521747c4..12b21585 100644 --- a/pywal/backends/wal.py +++ b/pywal/backends/wal.py @@ -7,8 +7,8 @@ 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) diff --git a/pywal/colors.py b/pywal/colors.py index fd2c68b6..7d6ab3ee 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -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): From d0855de1b809656fdc35992c1533cfdebad078e6 Mon Sep 17 00:00:00 2001 From: Todd Sonjiku Date: Thu, 20 May 2021 18:47:20 +0300 Subject: [PATCH 03/10] Added command line option --nine, which reverts to generating 9 colors, and alacritty output templates. --- pywal/__main__.py | 7 +- pywal/backends/colorthief.py | 8 +-- pywal/backends/colorz.py | 8 +-- pywal/backends/haishoku.py | 8 +-- pywal/backends/schemer2.py | 8 +-- pywal/backends/wal.py | 8 +-- pywal/colors.py | 75 ++++++++++++--------- pywal/templates/colors--nodim-alacritty.yml | 53 +++++++++++++++ pywal/templates/colors-alacritty.yml | 63 +++++++++++++++++ pywal/theme.py | 36 +++++++--- 10 files changed, 212 insertions(+), 62 deletions(-) create mode 100644 pywal/templates/colors--nodim-alacritty.yml create mode 100644 pywal/templates/colors-alacritty.yml diff --git a/pywal/__main__.py b/pywal/__main__.py index 91ead11f..2686416a 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -53,6 +53,9 @@ def get_args(): "flag is used: Go through the images in order " "instead of shuffled.") + arg.add_argument("--nine", action="store_true", + help="Use 9 color output. ") + arg.add_argument("--recursive", action="store_true", help="When pywal is given a directory as input and this " "flag is used: Search for images recursively in " @@ -175,7 +178,7 @@ def parse_args(parser): if args.i: image_file = image.get(args.i, iterative=args.iterative, recursive=args.recursive) - colors_plain = colors.get(image_file, args.l, args.backend, + colors_plain = colors.get(image_file, args.l, args.nine, args.backend, sat=args.saturate) if args.theme: @@ -186,7 +189,7 @@ def parse_args(parser): if args.w: cached_wallpaper = util.read_file(os.path.join(CACHE_DIR, "wal")) - colors_plain = colors.get(cached_wallpaper[0], args.l, args.backend, + colors_plain = colors.get(cached_wallpaper[0], args.l, args.nine, args.backend, sat=args.saturate) if args.b: diff --git a/pywal/backends/colorthief.py b/pywal/backends/colorthief.py index 1189b511..9675564a 100644 --- a/pywal/backends/colorthief.py +++ b/pywal/backends/colorthief.py @@ -37,15 +37,15 @@ def gen_colors(img): return [util.rgb_to_hex(color) for color in raw_colors] -def adjust(cols, light): +def adjust(cols, light, nine): """Create palette.""" cols.sort(key=util.rgb_to_yiq) raw_colors = [*cols, *cols] - return colors.generic_adjust(raw_colors, light) + return colors.generic_adjust(raw_colors, light, nine) -def get(img, light=False): +def get(img, light=False, nine=False): """Get colorscheme.""" cols = gen_colors(img) - return adjust(cols, light) + return adjust(cols, light, nine) diff --git a/pywal/backends/colorz.py b/pywal/backends/colorz.py index b789a3af..3ffec36e 100644 --- a/pywal/backends/colorz.py +++ b/pywal/backends/colorz.py @@ -23,15 +23,15 @@ def gen_colors(img): return [util.rgb_to_hex([*color[0]]) for color in raw_colors] -def adjust(cols, light): +def adjust(cols, light, nine): """Create palette.""" raw_colors = [cols[0], *cols, "#FFFFFF", "#000000", *cols, "#FFFFFF"] - return colors.generic_adjust(raw_colors, light) + return colors.generic_adjust(raw_colors, light, nine) -def get(img, light=False): +def get(img, light=False, nine=False): """Get colorscheme.""" cols = gen_colors(img) @@ -40,4 +40,4 @@ def get(img, light=False): logging.error("Try another backend or another image. (wal --backend)") sys.exit(1) - return adjust(cols, light) + return adjust(cols, light, nine) diff --git a/pywal/backends/haishoku.py b/pywal/backends/haishoku.py index 00025b29..ae8dd18e 100644 --- a/pywal/backends/haishoku.py +++ b/pywal/backends/haishoku.py @@ -22,16 +22,16 @@ def gen_colors(img): return [util.rgb_to_hex(col[1]) for col in palette] -def adjust(cols, light): +def adjust(cols, light, nine): """Create palette.""" cols.sort(key=util.rgb_to_yiq) raw_colors = [*cols, *cols] raw_colors[0] = util.lighten_color(cols[0], 0.40) - return colors.generic_adjust(raw_colors, light) + return colors.generic_adjust(raw_colors, light, nine) -def get(img, light=False): +def get(img, light=False, nine=False): """Get colorscheme.""" cols = gen_colors(img) - return adjust(cols, light) + return adjust(cols, light, nine) diff --git a/pywal/backends/schemer2.py b/pywal/backends/schemer2.py index adae6502..6fdd89f4 100644 --- a/pywal/backends/schemer2.py +++ b/pywal/backends/schemer2.py @@ -16,15 +16,15 @@ def gen_colors(img): return subprocess.check_output([*cmd, img]).splitlines() -def adjust(cols, light): +def adjust(cols, light, nine): """Create palette.""" cols.sort(key=util.rgb_to_yiq) raw_colors = [*cols[8:], *cols[8:]] - return colors.generic_adjust(raw_colors, light) + return colors.generic_adjust(raw_colors, light, nine) -def get(img, light=False): +def get(img, light=False, nine=False): """Get colorscheme.""" if not shutil.which("schemer2"): logging.error("Schemer2 wasn't found on your system.") @@ -32,4 +32,4 @@ def get(img, light=False): sys.exit(1) cols = [col.decode('UTF-8') for col in gen_colors(img)] - return adjust(cols, light) + return adjust(cols, light, nine) diff --git a/pywal/backends/wal.py b/pywal/backends/wal.py index 12b21585..fb1e0390 100644 --- a/pywal/backends/wal.py +++ b/pywal/backends/wal.py @@ -55,15 +55,15 @@ def gen_colors(img): return [re.search("#.{6}", str(col)).group(0) for col in raw_colors[1:]] -def adjust(cols, light): +def adjust(cols, light, nine): """Adjust the generated colors and store them in a dict that we will later save in json format.""" raw_colors = cols[:1] + cols[8:16] + cols[8:-1] - return colors.generic_adjust(raw_colors, light) + return colors.generic_adjust(raw_colors, light, nine) -def get(img, light=False): +def get(img, light=False, nine=False): """Get colorscheme.""" colors = gen_colors(img) - return adjust(colors, light) + return adjust(colors, light, nine) diff --git a/pywal/colors.py b/pywal/colors.py index 7d6ab3ee..8688b4b4 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -60,37 +60,51 @@ def colors_to_dict(colors, img): } -def generic_adjust(colors, light): +def generic_adjust(colors, light, nine): """Generic color adjustment for themers.""" if light: for color in colors: color = util.saturate_color(color, 0.60) color = util.darken_color(color, 0.5) - - - 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[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) + + if nine: + colors[0] = util.lighten_color(colors[0], 0.95) + colors[7] = util.darken_color(colors[0], 0.75) + colors[8] = util.darken_color(colors[0], 0.25) + colors[15] = colors[7] + + else: + + 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[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: - - 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[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) + if nine: + colors[0] = util.darken_color(colors[0], 0.80) + colors[7] = util.lighten_color(colors[0], 0.75) + colors[8] = util.lighten_color(colors[0], 0.25) + colors[15] = colors[7] + + else: + + 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[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) return colors @@ -106,15 +120,16 @@ def saturate_colors(colors, amount): return colors -def cache_fname(img, backend, light, cache_dir, sat=""): +def cache_fname(img, backend, nine, light, cache_dir, sat=""): """Create the cache file name.""" color_type = "light" if light else "dark" + color_num = "9" if nine else "16" file_name = re.sub("[/|\\|.]", "_", img) file_size = os.path.getsize(img) - file_parts = [file_name, color_type, backend, + file_parts = [file_name, color_num, color_type, backend, sat, file_size, __cache_version__] - return [cache_dir, "schemes", "%s_%s_%s_%s_%s_%s.json" % (*file_parts,)] + return [cache_dir, "schemes", "%s_%s_%s_%s_%s_%s_%s.json" % (*file_parts,)] def get_backend(backend): @@ -141,10 +156,10 @@ def palette(): print("\n") -def get(img, light=False, backend="wal", cache_dir=CACHE_DIR, sat=""): +def get(img, light=False, nine=False, backend="wal", cache_dir=CACHE_DIR, sat=""): """Generate a palette.""" # home_dylan_img_jpg_backend_1.2.2.json - cache_name = cache_fname(img, backend, light, cache_dir, sat) + cache_name = cache_fname(img, backend, nine, light, cache_dir, sat) cache_file = os.path.join(*cache_name) if os.path.isfile(cache_file): @@ -166,7 +181,7 @@ def get(img, light=False, backend="wal", cache_dir=CACHE_DIR, sat=""): logging.info("Using %s backend.", backend) backend = sys.modules["pywal.backends.%s" % backend] - colors = getattr(backend, "get")(img, light) + colors = getattr(backend, "get")(img, light, nine) colors = colors_to_dict(saturate_colors(colors, sat), img) util.save_file_json(colors, cache_file) diff --git a/pywal/templates/colors--nodim-alacritty.yml b/pywal/templates/colors--nodim-alacritty.yml new file mode 100644 index 00000000..a6990e19 --- /dev/null +++ b/pywal/templates/colors--nodim-alacritty.yml @@ -0,0 +1,53 @@ +colors: + + primary: + background: "{background}" + foreground: "{foreground}" + + cursor: + text: CellBackground + cursor: CellForeground + + vi_mode_cursor: + text: CellBackground + cursor: CellForeground + + search: + matches: + foreground: '{color0}' + background: '{color15}' + focused_match: + foreground: CellBackground + background: CellForeground + + bar: + foreground: '{color8}' + background: '{color7}' + + line_indicator: + foreground: None + background: None + + selection: + text: CellBackground + background: CellForeground + + normal: + black: "{color0}" + red: "{color1}" + green: "{color2}" + yellow: "{color3}" + blue: "{color4}" + magenta: "{color5}" + cyan: "{color6}" + white: "{color7}" + + bright: + black: "{color8}" + red: "{color9}" + green: "{color10}" + yellow: "{color11}" + blue: "{color12}" + magenta: "{color13}" + cyan: "{color14}" + white: "{color15}" diff --git a/pywal/templates/colors-alacritty.yml b/pywal/templates/colors-alacritty.yml new file mode 100644 index 00000000..febe33d6 --- /dev/null +++ b/pywal/templates/colors-alacritty.yml @@ -0,0 +1,63 @@ +colors: + + primary: + background: "{background}" + foreground: "{foreground}" + + cursor: + text: CellBackground + cursor: CellForeground + + vi_mode_cursor: + text: CellBackground + cursor: CellForeground + + search: + matches: + foreground: '{color0}' + background: '{color15}' + focused_match: + foreground: CellBackground + background: CellForeground + + bar: + foreground: '{color8}' + background: '{color7}' + + line_indicator: + foreground: None + background: None + + selection: + text: CellBackground + background: CellForeground + + normal: + black: "{color0}" + red: "{color1}" + green: "{color2}" + yellow: "{color3}" + blue: "{color4}" + magenta: "{color5}" + cyan: "{color6}" + white: "{color7}" + + bright: + black: "{color8}" + red: "{color9}" + green: "{color10}" + yellow: "{color11}" + blue: "{color12}" + magenta: "{color13}" + cyan: "{color14}" + white: "{color15}" + + dim: + black: "{color15}" + red: "{color9}" + green: "{color13}" + yellow: "{color11}" + blue: "{color12}" + magenta: "{color10}" + cyan: "{color14}" + white: "{color8}" diff --git a/pywal/theme.py b/pywal/theme.py index 9dc4f139..feddf4b9 100644 --- a/pywal/theme.py +++ b/pywal/theme.py @@ -16,6 +16,10 @@ def list_out(): for theme in list_themes()] ligh_themes = [theme.name.replace(".json", "") for theme in list_themes(dark=False)] + dark9_themes = [theme.name.replace(".json", "") + for theme in list_themes(nine=True)] + ligh9_themes = [theme.name.replace(".json", "") + for theme in list_themes(dark=False,nine=True)] user_themes = [theme.name.replace(".json", "") for theme in list_themes_user()] @@ -33,8 +37,14 @@ def list_out(): print("\033[1;32mDark Themes\033[0m:") print(" -", "\n - ".join(t + " (last used)" if t == last_used_theme else t for t in sorted(dark_themes))) + print("\033[1;32mDark9 Themes\033[0m:") + print(" -", "\n - ".join(t + " (last used)" if t == last_used_theme else t + for t in sorted(dark9_themes))) print("\033[1;32mLight Themes\033[0m:") + print(" -", "\n - ".join(t + " (last used)" if t == last_used_theme else t + for t in sorted(ligh_themes))) + print("\033[1;32mLight9 Themes\033[0m:") print(" -", "\n - ".join(t + " (last used)" if t == last_used_theme else t for t in sorted(ligh_themes))) @@ -45,17 +55,20 @@ def list_out(): print(" - random_user (select a random user theme)") -def list_themes(dark=True): +def list_themes(dark=True, nine=False): """List all installed theme files.""" dark = "dark" if dark else "light" - themes = os.scandir(os.path.join(MODULE_DIR, "colorschemes", dark)) + nine = "9" if nine else "16" + themes = os.scandir(os.path.join(MODULE_DIR, "colorschemes", dark, nine)) return [t for t in themes if os.path.isfile(t.path)] def list_themes_user(): """List user theme files.""" - themes = [*os.scandir(os.path.join(CONF_DIR, "colorschemes/dark/")), - *os.scandir(os.path.join(CONF_DIR, "colorschemes/light/"))] + themes = [*os.scandir(os.path.join(CONF_DIR, "colorschemes/dark/9")), + *os.scandir(os.path.join(CONF_DIR, "colorschemes/dark/16")), + *os.scandir(os.path.join(CONF_DIR, "colorschemes/light/9")), + *os.scandir(os.path.join(CONF_DIR, "colorschemes/light/16"))] return [t for t in themes if os.path.isfile(t.path)] @@ -91,7 +104,7 @@ def parse(theme_file): return data -def get_random_theme(dark=True): +def get_random_theme(dark=True, nine=False): """Get a random theme file.""" themes = [theme.path for theme in list_themes(dark)] random.shuffle(themes) @@ -105,16 +118,17 @@ def get_random_theme_user(): return themes[0] -def file(input_file, light=False): +def file(input_file, light=False, nine=False): """Import colorscheme from json file.""" util.create_dir(os.path.join(CONF_DIR, "colorschemes/light/")) util.create_dir(os.path.join(CONF_DIR, "colorschemes/dark/")) theme_name = ".".join((input_file, "json")) bri = "light" if light else "dark" + full16 = "9" if nine else "16" - user_theme_file = os.path.join(CONF_DIR, "colorschemes", bri, theme_name) - theme_file = os.path.join(MODULE_DIR, "colorschemes", bri, theme_name) + user_theme_file = os.path.join(CONF_DIR, "colorschemes", full16, bri, theme_name) + theme_file = os.path.join(MODULE_DIR, "colorschemes", full16, bri, theme_name) # Find the theme file. if input_file in ("random", "random_dark"): @@ -146,9 +160,11 @@ def file(input_file, light=False): sys.exit(1) -def save(colors, theme_name, light=False): +def save(colors, theme_name, light=False, nine=False): """Save colors to a theme file.""" theme_file = theme_name + ".json" theme_path = os.path.join(CONF_DIR, "colorschemes", - "light" if light else "dark", theme_file) + "9" if nine else "16", + "light" if light else "dark", + theme_file) util.save_file_json(colors, theme_path) From 685ea69702d3fecdc010cec817dc4f7b2bb0c571 Mon Sep 17 00:00:00 2001 From: eylles Date: Mon, 27 Dec 2021 13:16:10 -0600 Subject: [PATCH 04/10] remove added templates these should be their own PR --- pywal/templates/colors--nodim-alacritty.yml | 53 ----------------- pywal/templates/colors-alacritty.yml | 63 --------------------- 2 files changed, 116 deletions(-) delete mode 100644 pywal/templates/colors--nodim-alacritty.yml delete mode 100644 pywal/templates/colors-alacritty.yml diff --git a/pywal/templates/colors--nodim-alacritty.yml b/pywal/templates/colors--nodim-alacritty.yml deleted file mode 100644 index a6990e19..00000000 --- a/pywal/templates/colors--nodim-alacritty.yml +++ /dev/null @@ -1,53 +0,0 @@ -colors: - - primary: - background: "{background}" - foreground: "{foreground}" - - cursor: - text: CellBackground - cursor: CellForeground - - vi_mode_cursor: - text: CellBackground - cursor: CellForeground - - search: - matches: - foreground: '{color0}' - background: '{color15}' - focused_match: - foreground: CellBackground - background: CellForeground - - bar: - foreground: '{color8}' - background: '{color7}' - - line_indicator: - foreground: None - background: None - - selection: - text: CellBackground - background: CellForeground - - normal: - black: "{color0}" - red: "{color1}" - green: "{color2}" - yellow: "{color3}" - blue: "{color4}" - magenta: "{color5}" - cyan: "{color6}" - white: "{color7}" - - bright: - black: "{color8}" - red: "{color9}" - green: "{color10}" - yellow: "{color11}" - blue: "{color12}" - magenta: "{color13}" - cyan: "{color14}" - white: "{color15}" diff --git a/pywal/templates/colors-alacritty.yml b/pywal/templates/colors-alacritty.yml deleted file mode 100644 index febe33d6..00000000 --- a/pywal/templates/colors-alacritty.yml +++ /dev/null @@ -1,63 +0,0 @@ -colors: - - primary: - background: "{background}" - foreground: "{foreground}" - - cursor: - text: CellBackground - cursor: CellForeground - - vi_mode_cursor: - text: CellBackground - cursor: CellForeground - - search: - matches: - foreground: '{color0}' - background: '{color15}' - focused_match: - foreground: CellBackground - background: CellForeground - - bar: - foreground: '{color8}' - background: '{color7}' - - line_indicator: - foreground: None - background: None - - selection: - text: CellBackground - background: CellForeground - - normal: - black: "{color0}" - red: "{color1}" - green: "{color2}" - yellow: "{color3}" - blue: "{color4}" - magenta: "{color5}" - cyan: "{color6}" - white: "{color7}" - - bright: - black: "{color8}" - red: "{color9}" - green: "{color10}" - yellow: "{color11}" - blue: "{color12}" - magenta: "{color13}" - cyan: "{color14}" - white: "{color15}" - - dim: - black: "{color15}" - red: "{color9}" - green: "{color13}" - yellow: "{color11}" - blue: "{color12}" - magenta: "{color10}" - cyan: "{color14}" - white: "{color8}" From 5a134aacc6876ef00d616377308f46731adf016d Mon Sep 17 00:00:00 2001 From: eylles Date: Mon, 27 Dec 2021 13:20:09 -0600 Subject: [PATCH 05/10] Dont separate 9 and 16 cols themes wiht dirs this separation should be done in other way, not with dirs. --- pywal/theme.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pywal/theme.py b/pywal/theme.py index feddf4b9..89666ab4 100644 --- a/pywal/theme.py +++ b/pywal/theme.py @@ -65,10 +65,8 @@ def list_themes(dark=True, nine=False): def list_themes_user(): """List user theme files.""" - themes = [*os.scandir(os.path.join(CONF_DIR, "colorschemes/dark/9")), - *os.scandir(os.path.join(CONF_DIR, "colorschemes/dark/16")), - *os.scandir(os.path.join(CONF_DIR, "colorschemes/light/9")), - *os.scandir(os.path.join(CONF_DIR, "colorschemes/light/16"))] + themes = [*os.scandir(os.path.join(CONF_DIR, "colorschemes/dark/")), + *os.scandir(os.path.join(CONF_DIR, "colorschemes/light/"))] return [t for t in themes if os.path.isfile(t.path)] From 42efe31c95cad31158a40ab588fc8c198fbb3bc4 Mon Sep 17 00:00:00 2001 From: eylles Date: Tue, 28 Dec 2021 03:00:49 -0600 Subject: [PATCH 06/10] old adjust for color 0 --- pywal/colors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pywal/colors.py b/pywal/colors.py index 8688b4b4..7f39fea5 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -75,7 +75,7 @@ def generic_adjust(colors, light, nine): else: - colors[0] = util.lighten_color(colors[0], 0.75) + colors[0] = util.lighten_color(colors[0], 0.95) colors[7] = util.darken_color(colors[0], 0.50) colors[8] = util.darken_color(colors[0], 0.25) colors[1] = util.darken_color(colors[1], 0.25) @@ -95,7 +95,7 @@ def generic_adjust(colors, light, nine): else: - colors[0] = util.darken_color(colors[0], 0.75) + colors[0] = util.darken_color(colors[0], 0.80) colors[7] = util.lighten_color(colors[0], 0.50) colors[8] = util.lighten_color(colors[0], 0.25) colors[1] = util.darken_color(colors[1], 0.25) From 558b7e2796beb1b6284b4507806ddb119d59fb13 Mon Sep 17 00:00:00 2001 From: eylles Date: Tue, 28 Dec 2021 03:05:35 -0600 Subject: [PATCH 07/10] remove ref to 9 cols themes --- pywal/theme.py | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/pywal/theme.py b/pywal/theme.py index 89666ab4..9dc4f139 100644 --- a/pywal/theme.py +++ b/pywal/theme.py @@ -16,10 +16,6 @@ def list_out(): for theme in list_themes()] ligh_themes = [theme.name.replace(".json", "") for theme in list_themes(dark=False)] - dark9_themes = [theme.name.replace(".json", "") - for theme in list_themes(nine=True)] - ligh9_themes = [theme.name.replace(".json", "") - for theme in list_themes(dark=False,nine=True)] user_themes = [theme.name.replace(".json", "") for theme in list_themes_user()] @@ -37,14 +33,8 @@ def list_out(): print("\033[1;32mDark Themes\033[0m:") print(" -", "\n - ".join(t + " (last used)" if t == last_used_theme else t for t in sorted(dark_themes))) - print("\033[1;32mDark9 Themes\033[0m:") - print(" -", "\n - ".join(t + " (last used)" if t == last_used_theme else t - for t in sorted(dark9_themes))) print("\033[1;32mLight Themes\033[0m:") - print(" -", "\n - ".join(t + " (last used)" if t == last_used_theme else t - for t in sorted(ligh_themes))) - print("\033[1;32mLight9 Themes\033[0m:") print(" -", "\n - ".join(t + " (last used)" if t == last_used_theme else t for t in sorted(ligh_themes))) @@ -55,11 +45,10 @@ def list_out(): print(" - random_user (select a random user theme)") -def list_themes(dark=True, nine=False): +def list_themes(dark=True): """List all installed theme files.""" dark = "dark" if dark else "light" - nine = "9" if nine else "16" - themes = os.scandir(os.path.join(MODULE_DIR, "colorschemes", dark, nine)) + themes = os.scandir(os.path.join(MODULE_DIR, "colorschemes", dark)) return [t for t in themes if os.path.isfile(t.path)] @@ -102,7 +91,7 @@ def parse(theme_file): return data -def get_random_theme(dark=True, nine=False): +def get_random_theme(dark=True): """Get a random theme file.""" themes = [theme.path for theme in list_themes(dark)] random.shuffle(themes) @@ -116,17 +105,16 @@ def get_random_theme_user(): return themes[0] -def file(input_file, light=False, nine=False): +def file(input_file, light=False): """Import colorscheme from json file.""" util.create_dir(os.path.join(CONF_DIR, "colorschemes/light/")) util.create_dir(os.path.join(CONF_DIR, "colorschemes/dark/")) theme_name = ".".join((input_file, "json")) bri = "light" if light else "dark" - full16 = "9" if nine else "16" - user_theme_file = os.path.join(CONF_DIR, "colorschemes", full16, bri, theme_name) - theme_file = os.path.join(MODULE_DIR, "colorschemes", full16, bri, theme_name) + user_theme_file = os.path.join(CONF_DIR, "colorschemes", bri, theme_name) + theme_file = os.path.join(MODULE_DIR, "colorschemes", bri, theme_name) # Find the theme file. if input_file in ("random", "random_dark"): @@ -158,11 +146,9 @@ def file(input_file, light=False, nine=False): sys.exit(1) -def save(colors, theme_name, light=False, nine=False): +def save(colors, theme_name, light=False): """Save colors to a theme file.""" theme_file = theme_name + ".json" theme_path = os.path.join(CONF_DIR, "colorschemes", - "9" if nine else "16", - "light" if light else "dark", - theme_file) + "light" if light else "dark", theme_file) util.save_file_json(colors, theme_path) From 34e2dd28ab6e3728680297436b27ce635440472f Mon Sep 17 00:00:00 2001 From: eylles Date: Sun, 20 Feb 2022 05:16:09 -0600 Subject: [PATCH 08/10] change --nine to --cols16 restore old behaviour now the default behaviour is 9 colors again, and 16 colors is a flag --- pywal/__main__.py | 8 ++++---- pywal/backends/colorthief.py | 8 ++++---- pywal/backends/colorz.py | 8 ++++---- pywal/backends/haishoku.py | 8 ++++---- pywal/backends/schemer2.py | 8 ++++---- pywal/backends/wal.py | 8 ++++---- pywal/colors.py | 40 +++++++++++++++++------------------- 7 files changed, 43 insertions(+), 45 deletions(-) diff --git a/pywal/__main__.py b/pywal/__main__.py index 2686416a..3dc88273 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -53,8 +53,8 @@ def get_args(): "flag is used: Go through the images in order " "instead of shuffled.") - arg.add_argument("--nine", action="store_true", - help="Use 9 color output. ") + arg.add_argument("--cols16", action="store_true", + help="Use 16 color output. ") arg.add_argument("--recursive", action="store_true", help="When pywal is given a directory as input and this " @@ -178,7 +178,7 @@ def parse_args(parser): if args.i: image_file = image.get(args.i, iterative=args.iterative, recursive=args.recursive) - colors_plain = colors.get(image_file, args.l, args.nine, args.backend, + colors_plain = colors.get(image_file, args.l, args.cols16, args.backend, sat=args.saturate) if args.theme: @@ -189,7 +189,7 @@ def parse_args(parser): if args.w: cached_wallpaper = util.read_file(os.path.join(CACHE_DIR, "wal")) - colors_plain = colors.get(cached_wallpaper[0], args.l, args.nine, args.backend, + colors_plain = colors.get(cached_wallpaper[0], args.l, args.cols16, args.backend, sat=args.saturate) if args.b: diff --git a/pywal/backends/colorthief.py b/pywal/backends/colorthief.py index 9675564a..b8ac1ad2 100644 --- a/pywal/backends/colorthief.py +++ b/pywal/backends/colorthief.py @@ -37,15 +37,15 @@ def gen_colors(img): return [util.rgb_to_hex(color) for color in raw_colors] -def adjust(cols, light, nine): +def adjust(cols, light, cols16): """Create palette.""" cols.sort(key=util.rgb_to_yiq) raw_colors = [*cols, *cols] - return colors.generic_adjust(raw_colors, light, nine) + return colors.generic_adjust(raw_colors, light, cols16) -def get(img, light=False, nine=False): +def get(img, light=False, cols16=False): """Get colorscheme.""" cols = gen_colors(img) - return adjust(cols, light, nine) + return adjust(cols, light, cols16) diff --git a/pywal/backends/colorz.py b/pywal/backends/colorz.py index 3ffec36e..a08a3fec 100644 --- a/pywal/backends/colorz.py +++ b/pywal/backends/colorz.py @@ -23,15 +23,15 @@ def gen_colors(img): return [util.rgb_to_hex([*color[0]]) for color in raw_colors] -def adjust(cols, light, nine): +def adjust(cols, light, cols16): """Create palette.""" raw_colors = [cols[0], *cols, "#FFFFFF", "#000000", *cols, "#FFFFFF"] - return colors.generic_adjust(raw_colors, light, nine) + return colors.generic_adjust(raw_colors, light, cols16) -def get(img, light=False, nine=False): +def get(img, light=False, cols16=False): """Get colorscheme.""" cols = gen_colors(img) @@ -40,4 +40,4 @@ def get(img, light=False, nine=False): logging.error("Try another backend or another image. (wal --backend)") sys.exit(1) - return adjust(cols, light, nine) + return adjust(cols, light, cols16) diff --git a/pywal/backends/haishoku.py b/pywal/backends/haishoku.py index ae8dd18e..d4aaaf8e 100644 --- a/pywal/backends/haishoku.py +++ b/pywal/backends/haishoku.py @@ -22,16 +22,16 @@ def gen_colors(img): return [util.rgb_to_hex(col[1]) for col in palette] -def adjust(cols, light, nine): +def adjust(cols, light, cols16): """Create palette.""" cols.sort(key=util.rgb_to_yiq) raw_colors = [*cols, *cols] raw_colors[0] = util.lighten_color(cols[0], 0.40) - return colors.generic_adjust(raw_colors, light, nine) + return colors.generic_adjust(raw_colors, light, cols16) -def get(img, light=False, nine=False): +def get(img, light=False, cols16=False): """Get colorscheme.""" cols = gen_colors(img) - return adjust(cols, light, nine) + return adjust(cols, light, cols16) diff --git a/pywal/backends/schemer2.py b/pywal/backends/schemer2.py index 6fdd89f4..af726260 100644 --- a/pywal/backends/schemer2.py +++ b/pywal/backends/schemer2.py @@ -16,15 +16,15 @@ def gen_colors(img): return subprocess.check_output([*cmd, img]).splitlines() -def adjust(cols, light, nine): +def adjust(cols, light, cols16): """Create palette.""" cols.sort(key=util.rgb_to_yiq) raw_colors = [*cols[8:], *cols[8:]] - return colors.generic_adjust(raw_colors, light, nine) + return colors.generic_adjust(raw_colors, light, cols16) -def get(img, light=False, nine=False): +def get(img, light=False, cols16=False): """Get colorscheme.""" if not shutil.which("schemer2"): logging.error("Schemer2 wasn't found on your system.") @@ -32,4 +32,4 @@ def get(img, light=False, nine=False): sys.exit(1) cols = [col.decode('UTF-8') for col in gen_colors(img)] - return adjust(cols, light, nine) + return adjust(cols, light, cols16) diff --git a/pywal/backends/wal.py b/pywal/backends/wal.py index fb1e0390..423ff6d0 100644 --- a/pywal/backends/wal.py +++ b/pywal/backends/wal.py @@ -55,15 +55,15 @@ def gen_colors(img): return [re.search("#.{6}", str(col)).group(0) for col in raw_colors[1:]] -def adjust(cols, light, nine): +def adjust(cols, light, cols16): """Adjust the generated colors and store them in a dict that we will later save in json format.""" raw_colors = cols[:1] + cols[8:16] + cols[8:-1] - return colors.generic_adjust(raw_colors, light, nine) + return colors.generic_adjust(raw_colors, light, cols16) -def get(img, light=False, nine=False): +def get(img, light=False, cols16=False): """Get colorscheme.""" colors = gen_colors(img) - return adjust(colors, light, nine) + return adjust(colors, light, cols16) diff --git a/pywal/colors.py b/pywal/colors.py index 7f39fea5..71884d6b 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -60,21 +60,14 @@ def colors_to_dict(colors, img): } -def generic_adjust(colors, light, nine): +def generic_adjust(colors, light, cols16): """Generic color adjustment for themers.""" if light: for color in colors: color = util.saturate_color(color, 0.60) color = util.darken_color(color, 0.5) - if nine: - colors[0] = util.lighten_color(colors[0], 0.95) - colors[7] = util.darken_color(colors[0], 0.75) - colors[8] = util.darken_color(colors[0], 0.25) - colors[15] = colors[7] - - else: - + if cols16: colors[0] = util.lighten_color(colors[0], 0.95) colors[7] = util.darken_color(colors[0], 0.50) colors[8] = util.darken_color(colors[0], 0.25) @@ -86,15 +79,14 @@ def generic_adjust(colors, light, nine): colors[6] = util.darken_color(colors[6], 0.25) colors[15] = util.darken_color(colors[0], 0.75) - else: - if nine: - colors[0] = util.darken_color(colors[0], 0.80) - colors[7] = util.lighten_color(colors[0], 0.75) - colors[8] = util.lighten_color(colors[0], 0.25) - colors[15] = colors[7] - else: + colors[0] = util.lighten_color(colors[0], 0.95) + colors[7] = util.darken_color(colors[0], 0.75) + colors[8] = util.darken_color(colors[0], 0.25) + colors[15] = colors[7] + else: + if cols16: colors[0] = util.darken_color(colors[0], 0.80) colors[7] = util.lighten_color(colors[0], 0.50) colors[8] = util.lighten_color(colors[0], 0.25) @@ -106,6 +98,12 @@ def generic_adjust(colors, light, nine): colors[6] = util.darken_color(colors[6], 0.25) colors[15] = util.lighten_color(colors[0], 0.75) + else: + colors[0] = util.darken_color(colors[0], 0.80) + colors[7] = util.lighten_color(colors[0], 0.75) + colors[8] = util.lighten_color(colors[0], 0.25) + colors[15] = colors[7] + return colors @@ -120,10 +118,10 @@ def saturate_colors(colors, amount): return colors -def cache_fname(img, backend, nine, light, cache_dir, sat=""): +def cache_fname(img, backend, cols16, light, cache_dir, sat=""): """Create the cache file name.""" color_type = "light" if light else "dark" - color_num = "9" if nine else "16" + color_num = "9" if cols16 else "16" file_name = re.sub("[/|\\|.]", "_", img) file_size = os.path.getsize(img) @@ -156,10 +154,10 @@ def palette(): print("\n") -def get(img, light=False, nine=False, backend="wal", cache_dir=CACHE_DIR, sat=""): +def get(img, light=False, cols16=False, backend="wal", cache_dir=CACHE_DIR, sat=""): """Generate a palette.""" # home_dylan_img_jpg_backend_1.2.2.json - cache_name = cache_fname(img, backend, nine, light, cache_dir, sat) + cache_name = cache_fname(img, backend, cols16, light, cache_dir, sat) cache_file = os.path.join(*cache_name) if os.path.isfile(cache_file): @@ -181,7 +179,7 @@ def get(img, light=False, nine=False, backend="wal", cache_dir=CACHE_DIR, sat="" logging.info("Using %s backend.", backend) backend = sys.modules["pywal.backends.%s" % backend] - colors = getattr(backend, "get")(img, light, nine) + colors = getattr(backend, "get")(img, light, cols16) colors = colors_to_dict(saturate_colors(colors, sat), img) util.save_file_json(colors, cache_file) From 7aa7085d5f13ba752a6600a9f65de06be580d94b Mon Sep 17 00:00:00 2001 From: eylles Date: Sun, 20 Feb 2022 05:41:29 -0600 Subject: [PATCH 09/10] use 16 color adjust in fast_colorthief --- pywal/backends/fast_colorthief.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/pywal/backends/fast_colorthief.py b/pywal/backends/fast_colorthief.py index b68ff023..4d62b305 100644 --- a/pywal/backends/fast_colorthief.py +++ b/pywal/backends/fast_colorthief.py @@ -13,6 +13,7 @@ sys.exit(1) from .. import util +from .. import colors def gen_colors(img): @@ -22,29 +23,15 @@ def gen_colors(img): return [util.rgb_to_hex(color) for color in raw_colors] -def adjust(cols, light): +def adjust(cols, light, cols16): """Create palette.""" cols.sort(key=util.rgb_to_yiq) raw_colors = [*cols, *cols] - if light: - raw_colors[0] = util.lighten_color(cols[0], 0.90) - raw_colors[7] = util.darken_color(cols[0], 0.75) + return colors.generic_adjust(raw_colors, light, cols16) - else: - for color in raw_colors: - color = util.lighten_color(color, 0.40) - raw_colors[0] = util.darken_color(cols[0], 0.80) - raw_colors[7] = util.lighten_color(cols[0], 0.60) - - raw_colors[8] = util.lighten_color(cols[0], 0.20) - raw_colors[15] = raw_colors[7] - - return raw_colors - - -def get(img, light=False): +def get(img, light=False, cols16=False): """Get colorscheme.""" cols = gen_colors(img) - return adjust(cols, light) + return adjust(cols, light, cols16) From a60a91f9f093ca8d3597257cedc0b3ab2f68c2fc Mon Sep 17 00:00:00 2001 From: eylles Date: Sat, 12 Mar 2022 01:23:21 -0600 Subject: [PATCH 10/10] correct name of cached theme json the names used to be backwards with a 9 being added to 16 color themes and visceversa. --- pywal/colors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pywal/colors.py b/pywal/colors.py index 71884d6b..a59f5b25 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -121,7 +121,7 @@ def saturate_colors(colors, amount): def cache_fname(img, backend, cols16, light, cache_dir, sat=""): """Create the cache file name.""" color_type = "light" if light else "dark" - color_num = "9" if cols16 else "16" + color_num = "16" if cols16 else "9" file_name = re.sub("[/|\\|.]", "_", img) file_size = os.path.getsize(img)