mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-02-03 12:00:21 +01:00
backend: Add random option
This commit is contained in:
parent
d8dd569dc1
commit
d5f39135b2
@ -38,12 +38,13 @@ def get_args(args):
|
|||||||
help="Custom background color to use.")
|
help="Custom background color to use.")
|
||||||
|
|
||||||
arg.add_argument("--backend", metavar="backend",
|
arg.add_argument("--backend", metavar="backend",
|
||||||
help="Which color backend to use.",
|
help="Which color backend to use. \
|
||||||
|
Use 'wal --backend' to list backends.",
|
||||||
const="list_backends", type=str, nargs="?", default="wal")
|
const="list_backends", type=str, nargs="?", default="wal")
|
||||||
|
|
||||||
arg.add_argument("--theme", metavar="/path/to/file or theme_name",
|
arg.add_argument("--theme", metavar="/path/to/file or theme_name",
|
||||||
help="Which colorscheme file to use. \
|
help="Which colorscheme file to use. \
|
||||||
Use 'wal -f' to list available builtin themes.",
|
Use 'wal --theme' to list builtin themes.",
|
||||||
const="list_themes", nargs="?")
|
const="list_themes", nargs="?")
|
||||||
|
|
||||||
arg.add_argument("-c", action="store_true",
|
arg.add_argument("-c", action="store_true",
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
Generate a palette using various backends.
|
Generate a palette using various backends.
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
import random
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -94,6 +95,13 @@ def get(img, light=False, backend="wal", cache_dir=CACHE_DIR):
|
|||||||
else:
|
else:
|
||||||
print("wal: Generating a colorscheme...")
|
print("wal: Generating a colorscheme...")
|
||||||
|
|
||||||
|
if backend == "random":
|
||||||
|
backends = list_backends()
|
||||||
|
random.shuffle(backends)
|
||||||
|
backend = backends[0]
|
||||||
|
|
||||||
|
print("wal: Using", backend, "backend.")
|
||||||
|
|
||||||
# Dynamically import the backend we want to use.
|
# Dynamically import the backend we want to use.
|
||||||
# This keeps the dependencies "optional".
|
# This keeps the dependencies "optional".
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user