2 Generate a colorscheme using Schemer2.
14 """Generate a colorscheme using Colorz."""
15 cmd = ["schemer2", "-format", "img::colors", "-minBright", "75", "-in"]
16 return subprocess.check_output([*cmd, img]).splitlines()
19 def adjust(cols, light):
21 cols.sort(key=util.rgb_to_yiq)
22 raw_colors = [*cols[8:], *cols[8:]]
24 return colors.generic_adjust(raw_colors, light)
27 def get(img, light=False):
28 """Get colorscheme."""
29 if not shutil.which("schemer2"):
30 logging.error("Schemer2 wasn't found on your system.")
31 logging.error("Try another backend. (wal --backend)")
34 cols = [col.decode('UTF-8') for col in gen_colors(img)]
35 return adjust(cols, light)