diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2018-04-01 16:40:17 +1000 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2018-04-01 16:40:17 +1000 |
| commit | dc8ca8af2792090c83ee58749b72e40e66301625 (patch) | |
| tree | 98adc8aea7b6a01164f34fe93f2af533da2aa20c | |
| parent | 9c8ea3e45e92b890c4517fd90d6f5347bfcfeec9 (diff) | |
general: Add palette to output.
| -rw-r--r-- | pywal/__main__.py | 1 | ||||
| -rw-r--r-- | pywal/colors.py | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/pywal/__main__.py b/pywal/__main__.py index eb2c6e7..d273cc1 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -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: diff --git a/pywal/colors.py b/pywal/colors.py index 280f090..157f7df 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -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.""" |
