From 90a73edda5a6484a8ad4dc081e22c0d9e53cc5e1 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 15 Mar 2018 17:19:01 +1100 Subject: [PATCH] themes: Add support for terminal.sexy json --- pywal/colors.py | 22 ++++++++++++++++++++++ pywal/colorschemes/gruvbox.json | 2 +- pywal/colorschemes/zenburn.json | 25 +++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 pywal/colorschemes/zenburn.json 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: diff --git a/pywal/colorschemes/gruvbox.json b/pywal/colorschemes/gruvbox.json index 5f7f8f7..6f864d6 100644 --- a/pywal/colorschemes/gruvbox.json +++ b/pywal/colorschemes/gruvbox.json @@ -2,7 +2,7 @@ "special": { "background": "#282828", "foreground": "#a89984", - "cursor": "#dc322f" + "cursor": "#cc241d" }, "colors": { "color0": "#282828", diff --git a/pywal/colorschemes/zenburn.json b/pywal/colorschemes/zenburn.json new file mode 100644 index 0000000..b0b9c53 --- /dev/null +++ b/pywal/colorschemes/zenburn.json @@ -0,0 +1,25 @@ +{ + "special": { + "background": "#3f3f3f", + "foreground": "#dcdccc", + "cursor": "#cc9393" + }, + "colors": { + "color0": "#3f3f3f", + "color1": "#cc9393", + "color2": "#7f9f7f", + "color3": "#d0bf8f", + "color4": "#6ca0a3", + "color5": "#dc8cc3", + "color6": "#93e0e3", + "color7": "#dcdccc", + "color8": "#828282", + "color9": "#cc9393", + "color10": "#7f9f7f", + "color11": "#d0bf8f", + "color12": "#6ca0a3", + "color13": "#dc8cc3", + "color14": "#93e0e3", + "color15": "#dcdccc" + } +}