mirror of
https://github.com/dylanaraps/pywal.git
synced 2024-12-01 12:24:36 +01:00
general: Added user template support.
This commit is contained in:
parent
a8a761fea1
commit
4d20ea1e51
@ -3,7 +3,7 @@ Export colors in various formats.
|
||||
"""
|
||||
import os
|
||||
|
||||
from .settings import CACHE_DIR, MODULE_DIR
|
||||
from .settings import CACHE_DIR, MODULE_DIR, CONF_DIR
|
||||
from . import util
|
||||
|
||||
|
||||
@ -42,13 +42,19 @@ def get_export_type(export_type):
|
||||
|
||||
def every(colors, output_dir=CACHE_DIR):
|
||||
"""Export all template files."""
|
||||
all_colors = flatten_colors(colors)
|
||||
colors = flatten_colors(colors)
|
||||
template_dir = os.path.join(MODULE_DIR, "templates")
|
||||
template_dir_user = os.path.join(CONF_DIR, "templates")
|
||||
util.create_dir(template_dir_user)
|
||||
|
||||
for file in os.scandir(template_dir):
|
||||
template(all_colors, file.path, os.path.join(output_dir, file.name))
|
||||
template(colors, file.path, os.path.join(output_dir, file.name))
|
||||
|
||||
for file in os.scandir(template_dir_user):
|
||||
template(colors, file.path, os.path.join(output_dir, file.name))
|
||||
|
||||
print("export: Exported all files.")
|
||||
print("export: Exported all user files.")
|
||||
|
||||
|
||||
def color(colors, export_type, output_file=None):
|
||||
|
@ -19,5 +19,6 @@ __version__ = "0.7.3"
|
||||
HOME = os.getenv("HOME", os.getenv("USERPROFILE"))
|
||||
CACHE_DIR = os.path.join(HOME, ".cache", "wal")
|
||||
MODULE_DIR = os.path.dirname(__file__)
|
||||
CONF_DIR = os.path.join(HOME, ".config", "wal")
|
||||
COLOR_COUNT = 16
|
||||
OS = platform.uname()[0]
|
||||
|
@ -33,6 +33,11 @@ class Color:
|
||||
"""Add URxvt alpha value to color."""
|
||||
return "[%s]%s" % (self.alpha_num, self.hex_color)
|
||||
|
||||
@property
|
||||
def strip(self):
|
||||
"""Strip '#' from color."""
|
||||
return self.hex_color[1:]
|
||||
|
||||
|
||||
def read_file(input_file):
|
||||
"""Read data from a file and trim newlines."""
|
||||
|
Loading…
Reference in New Issue
Block a user