From d8beb4de12314af6cbc62f88c33d889db7b0dfd8 Mon Sep 17 00:00:00 2001 From: Howland Owl Date: Wed, 26 Apr 2017 03:44:20 +0300 Subject: [PATCH] changes to make the output paste nicely into the config.h --- xrdb2st.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/xrdb2st.py b/xrdb2st.py index abba869..4069a4e 100755 --- a/xrdb2st.py +++ b/xrdb2st.py @@ -15,6 +15,7 @@ def main(filename): f = open(filename) colors = {} c2 = {} + print("{") for i in f.readlines(): (crap,color,rgb)=i.split(' ') cbits = color.split('_') @@ -34,29 +35,32 @@ def main(filename): pass l = colors.keys() for i in l: - print('"'+colors[i]+'", // '+str(i)) + print(' "'+colors[i]+'", // '+str(i)) x = 256 +# the 255 line + print(" [255] = 0,") try: - print("static unsigned int defaultbg = " + str(c2[bg])) +';' + print("//static unsigned int defaultbg = " + str(c2[bg])) +';' except: - print('"'+bg+'", /* bg color */') - print("static unsigned int defaultbg = " + str(x)) +';' + print(' "'+bg+'", /* bg color */') + print("//static unsigned int defaultbg = " + str(x)) +';' x=x+1 try: - print("static unsigned int defaultfg = " + str(c2[fg])) +';' + print("//static unsigned int defaultfg = " + str(c2[fg])) +';' except: - print('"'+fg+'", /* fg color */') - print("static unsigned int defaultfg = " + str(x)) +';' + print(' "'+fg+'", /* fg color */') + print("//static unsigned int defaultfg = " + str(x)) +';' x=x+1 try: - print("static unsigned int defaultcs = " + str(c2[cs])) +';' + print("//static unsigned int defaultcs = " + str(c2[cs])) +';' except: - print('"'+cs+'" /* cs color */') - print("static unsigned int defaultcs = " + str(x)) +';' + print(' "'+cs+'" /* cs color */') + print("//static unsigned int defaultcs = " + str(x)) +';' + print("},") if __name__ == '__main__':