From 0f144c1ef9d831b1c663ef998f40e22c33156d9e Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Fri, 8 Sep 2023 14:43:41 +0530 Subject: Initial Commit * Adds Basic dot files configs --- .config/kitty/kitty-themes/.tools/convert.py | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .config/kitty/kitty-themes/.tools/convert.py (limited to '.config/kitty/kitty-themes/.tools/convert.py') diff --git a/.config/kitty/kitty-themes/.tools/convert.py b/.config/kitty/kitty-themes/.tools/convert.py new file mode 100644 index 0000000..3599ddc --- /dev/null +++ b/.config/kitty/kitty-themes/.tools/convert.py @@ -0,0 +1,30 @@ +import json +from jinja2 import FileSystemLoader, Environment +import sys +import os + + +def removeAlpha(value): + hex = value.lstrip("#") + return "#" + hex[0:6] + + +filename = sys.argv[1] + +kitty_configuration = os.path.splitext(filename)[0] + ".conf" + +with open(filename, "r") as configuration_file: + configuration = json.load(configuration_file) + +loader = FileSystemLoader(".") +env = Environment(loader=loader) + +env.filters['removeAlpha'] = removeAlpha +env.trim_blocks = True + +template = env.get_template("template.conf.j2") + +output = template.render(**configuration) + +with open(kitty_configuration, "w") as fp: + fp.write(output) -- cgit v1.2.3