general: Add palette to output.

This commit is contained in:
Dylan Araps 2018-04-01 16:40:17 +10:00
parent 9c8ea3e45e
commit dc8ca8af27
2 changed files with 19 additions and 0 deletions

View File

@ -158,6 +158,7 @@ def process_args(args):
wallpaper.change(colors_plain["wallpaper"])
sequences.send(colors_plain, to_send=not args.s)
colors.palette()
export.every(colors_plain)
if not args.e:

View File

@ -89,6 +89,24 @@ def get_backend(backend):
random.shuffle(backends)
return backends[0]
return backend
def palette():
"""Generate a palette from the colors."""
col_width = " " * (os.get_terminal_size().columns // 8)
for i in range(0, 16):
if i % 8 == 0:
print()
if i > 7:
i = "8;5;%s" % i
print("\033[4%sm%s\033[0m" % (i, col_width), end="")
print("\n")
def get(img, light=False, backend="wal", cache_dir=CACHE_DIR):
"""Generate a palette."""