summaryrefslogtreecommitdiff
path: root/.config/kitty/kitty-themes/.tools/convert.py
diff options
context:
space:
mode:
authorIndrajith K L2023-09-08 14:43:41 +0530
committerIndrajith K L2023-09-08 14:43:41 +0530
commit0f144c1ef9d831b1c663ef998f40e22c33156d9e (patch)
treedd20b22ce18b5e6e0b00b43d1b5a2699792563f1 /.config/kitty/kitty-themes/.tools/convert.py
downloadDotFiles-master.tar.gz
DotFiles-master.tar.bz2
DotFiles-master.zip
Initial CommitHEADmaster
* Adds Basic dot files configs
Diffstat (limited to '.config/kitty/kitty-themes/.tools/convert.py')
-rw-r--r--.config/kitty/kitty-themes/.tools/convert.py30
1 files changed, 30 insertions, 0 deletions
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)