diff --git a/pywal/backends/__init__.py b/pywal/backends/__init__.py index d1eb6e7..d267a77 100644 --- a/pywal/backends/__init__.py +++ b/pywal/backends/__init__.py @@ -11,12 +11,14 @@ Created by Dylan Araps. from . import colorthief from . import colorz +from . import haishoku from . import schemer2 from . import wal __all__ = [ "colorthief", "colorz", + "haishoku", "schemer2", "wal", ] diff --git a/pywal/backends/colorz.py b/pywal/backends/colorz.py index 44e75cb..0c5148d 100644 --- a/pywal/backends/colorz.py +++ b/pywal/backends/colorz.py @@ -17,8 +17,8 @@ def gen_colors(img): def adjust(cols, light): """Create palette.""" - # Create list with placeholder values. bg = util.blend_color("#555555", cols[1]) + raw_colors = [bg, *cols, "#FFFFFF", "#333333", *cols, "#FFFFFF"] diff --git a/pywal/backends/haishoku.py b/pywal/backends/haishoku.py new file mode 100644 index 0000000..413c9d7 --- /dev/null +++ b/pywal/backends/haishoku.py @@ -0,0 +1,36 @@ +""" +Generate a colorscheme using Haishoku. +""" +import sys + +try: + from haishoku.haishoku import Haishoku + +except ImportError: + print("error: Haishoku wasn't found on your system.", + "Try another backend. (wal --backend)") + sys.exit(1) + +from .. import colors +from .. import util + + +def gen_colors(img): + """Generate a colorscheme using Colorz.""" + palette = Haishoku.getPalette(img) + return [util.rgb_to_hex(col[1]) for col in palette] + + +def adjust(cols, light): + """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) + + +def get(img, light=False): + """Get colorscheme.""" + cols = gen_colors(img) + return adjust(cols, light) diff --git a/pywal/backends/schemer2.py b/pywal/backends/schemer2.py index c3d81d7..87873ec 100644 --- a/pywal/backends/schemer2.py +++ b/pywal/backends/schemer2.py @@ -17,7 +17,6 @@ def gen_colors(img): def adjust(cols, light): """Create palette.""" - # Create list with placeholder values. cols.sort(key=util.rgb_to_yiq) raw_colors = [*cols[8:], *cols[8:]]