diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2018-03-15 17:19:01 +1100 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2018-03-15 17:19:01 +1100 |
| commit | 90a73edda5a6484a8ad4dc081e22c0d9e53cc5e1 (patch) | |
| tree | b16290d5e17a3478bc3ad0fbd25dd8c2d3b41a2a /pywal/colors.py | |
| parent | a95d901deab1abd19fb4bacd9b4704eae48c0ffb (diff) | |
themes: Add support for terminal.sexy json
Diffstat (limited to 'pywal/colors.py')
| -rw-r--r-- | pywal/colors.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pywal/colors.py b/pywal/colors.py index 4bd3655..bff33c4 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -127,6 +127,24 @@ def get(img, cache_dir=CACHE_DIR, return colors +def terminal_sexy_to_wal(data): + """Convert terminal.sexy json schema to wal.""" + data["colors"] = {} + data["special"] = {} + + for i in range(0, 16): + data["colors"]["color%s" % i] = data["color"][i if i < 9 else i - 8] + + data["colors"]["color0"] = data["background"] + data["colors"]["color7"] = data["foreground"] + data["colors"]["color15"] = data["foreground"] + data["special"]["foreground"] = data["foreground"] + data["special"]["background"] = data["background"] + data["special"]["cursor"] = data["colors"]["color1"] + + return data + + def file(input_file): """Import colorscheme from json file.""" theme_file = os.path.join(MODULE_DIR, "colorschemes", @@ -144,6 +162,10 @@ def file(input_file): if "alpha" not in data: data["alpha"] = "100" + # Terminal.sexy format. + if isinstance(data["color"], list): + data = terminal_sexy_to_wal(data) + return data else: |
