changes to make the output paste nicely into the config.h

This commit is contained in:
Howland Owl 2017-04-26 03:44:20 +03:00
parent 54e8055963
commit d8beb4de12

View file

@ -15,6 +15,7 @@ def main(filename):
f = open(filename) f = open(filename)
colors = {} colors = {}
c2 = {} c2 = {}
print("{")
for i in f.readlines(): for i in f.readlines():
(crap,color,rgb)=i.split(' ') (crap,color,rgb)=i.split(' ')
cbits = color.split('_') cbits = color.split('_')
@ -34,29 +35,32 @@ def main(filename):
pass pass
l = colors.keys() l = colors.keys()
for i in l: for i in l:
print('"'+colors[i]+'", // '+str(i)) print(' "'+colors[i]+'", // '+str(i))
x = 256 x = 256
# the 255 line
print(" [255] = 0,")
try: try:
print("static unsigned int defaultbg = " + str(c2[bg])) +';' print("//static unsigned int defaultbg = " + str(c2[bg])) +';'
except: except:
print('"'+bg+'", /* bg color */') print(' "'+bg+'", /* bg color */')
print("static unsigned int defaultbg = " + str(x)) +';' print("//static unsigned int defaultbg = " + str(x)) +';'
x=x+1 x=x+1
try: try:
print("static unsigned int defaultfg = " + str(c2[fg])) +';' print("//static unsigned int defaultfg = " + str(c2[fg])) +';'
except: except:
print('"'+fg+'", /* fg color */') print(' "'+fg+'", /* fg color */')
print("static unsigned int defaultfg = " + str(x)) +';' print("//static unsigned int defaultfg = " + str(x)) +';'
x=x+1 x=x+1
try: try:
print("static unsigned int defaultcs = " + str(c2[cs])) +';' print("//static unsigned int defaultcs = " + str(c2[cs])) +';'
except: except:
print('"'+cs+'" /* cs color */') print(' "'+cs+'" /* cs color */')
print("static unsigned int defaultcs = " + str(x)) +';' print("//static unsigned int defaultcs = " + str(x)) +';'
print("},")
if __name__ == '__main__': if __name__ == '__main__':