summaryrefslogtreecommitdiff
path: root/pywal/colors.py
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2018-04-01 16:40:17 +1000
committerDylan Araps <dylan.araps@gmail.com>2018-04-01 16:40:17 +1000
commitdc8ca8af2792090c83ee58749b72e40e66301625 (patch)
tree98adc8aea7b6a01164f34fe93f2af533da2aa20c /pywal/colors.py
parent9c8ea3e45e92b890c4517fd90d6f5347bfcfeec9 (diff)
general: Add palette to output.
Diffstat (limited to 'pywal/colors.py')
-rw-r--r--pywal/colors.py18
1 files changed, 18 insertions, 0 deletions
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."""