Emacs script

The emacs colorscheme script now reads the JSON file at root of the
directory to get bg, fg and colors.
master
lomna-dev 1 year ago
parent 3fd8cd50de
commit 61f0aa7f1e

@ -1,3 +1,25 @@
import json
""" This file reads the JSON file in root directory and converts it to emacs color theme. The theme is written on stdout and can be copied into a file and loaded in emacs without any modifications. """
background = ""
foreground = ""
colors = []
with open("../JSON", 'r') as f:
d = json.loads(f.read())
background = d['background']
foreground = d['foreground']
colors = d['color']
print(";; foreground : " + foreground)
print(";; background : " + background)
i = 0
for c in colors:
print(";; color" + str(i) + " " + c)
i += 1
print("""
(deftheme {theme_name}
"Add some description here")
@ -91,4 +113,4 @@ print("""
`(message-separator ((,class (:foreground "{white}" :weight bold))))))
(provide-theme '{theme_name})
""".format(theme_name="anmol-test",bg="#100f1f", fg="#fcffdc", black="#212125", red="#c24949", green="#3eca3e", yellow="#dcdc0f", blue="#6d6df3", magenta="#d068d0", cyan="#00cbcb", white="#e2e2e2", bright_black="#80776f", bright_red="#c25959", bright_green="#3eca3e", bright_yellow="#dcdc00", bright_blue="#915bf3", bright_magenta="#d040d0", bright_cyan="#78dada", bright_white="#f5f5f5"))
""".format(theme_name="anmol-test",bg=background, fg=foreground, black=colors[0], red=colors[1], green=colors[2], yellow=colors[3], blue=colors[4], magenta=colors[5], cyan=colors[6], white=colors[7], bright_black=colors[8], bright_red=colors[9], bright_green=colors[10], bright_yellow=colors[11], bright_blue=colors[12], bright_magenta=colors[13], bright_cyan=colors[14], bright_white=colors[15]))

Loading…
Cancel
Save