mirror of
https://github.com/dylanaraps/pywal.git
synced 2024-11-25 09:23:08 +01:00
themes: Allow local themes
This commit is contained in:
parent
e76887915f
commit
7db89a3907
@ -14,7 +14,7 @@ import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
from .settings import __version__, CACHE_DIR, MODULE_DIR
|
||||
from .settings import __version__, CACHE_DIR, MODULE_DIR, CONF_DIR
|
||||
from . import colors
|
||||
from . import export
|
||||
from . import image
|
||||
@ -125,7 +125,8 @@ def process_args(args):
|
||||
colors_plain = colors.get(image_file, light=args.l)
|
||||
|
||||
if args.f == "list_themes":
|
||||
themes = os.listdir(os.path.join(MODULE_DIR, "colorschemes"))
|
||||
themes = os.listdir(os.path.join(CONF_DIR, "colorschemes"))
|
||||
themes += os.listdir(os.path.join(MODULE_DIR, "colorschemes"))
|
||||
|
||||
print("Themes:",
|
||||
", ".join([theme.replace(".json", "") for theme in themes]))
|
||||
|
@ -7,7 +7,8 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from .settings import CACHE_DIR, COLOR_COUNT, MODULE_DIR, __cache_version__
|
||||
from .settings import CACHE_DIR, COLOR_COUNT, MODULE_DIR, \
|
||||
CONF_DIR, __cache_version__
|
||||
from . import util
|
||||
|
||||
|
||||
@ -144,10 +145,17 @@ def terminal_sexy_to_wal(data):
|
||||
|
||||
def file(input_file):
|
||||
"""Import colorscheme from json file."""
|
||||
theme_file = os.path.join(MODULE_DIR, "colorschemes",
|
||||
".".join((input_file, "json")))
|
||||
theme_file = ".".join((input_file, "json"))
|
||||
user_theme_dir = os.path.join(CONF_DIR, "colorschemes")
|
||||
user_theme_file = os.path.join(user_theme_dir, theme_file)
|
||||
theme_file = os.path.join(MODULE_DIR, "colorschemes", theme_file)
|
||||
|
||||
if os.path.isfile(theme_file):
|
||||
util.create_dir(user_theme_dir)
|
||||
|
||||
if os.path.isfile(user_theme_file):
|
||||
input_file = user_theme_file
|
||||
|
||||
elif os.path.isfile(theme_file):
|
||||
input_file = theme_file
|
||||
|
||||
if os.path.isfile(input_file):
|
||||
|
Loading…
Reference in New Issue
Block a user