71 lines
1.7 KiB
Python
71 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
#coding:utf-8
|
|
"""
|
|
Purpose: foot conf to st-color-at-start
|
|
Created: 04.01.2021
|
|
"""
|
|
|
|
import argparse
|
|
|
|
def main(args):
|
|
"""open foot file, parse, and dump st script"""
|
|
with open(args.filename) as fh:
|
|
lines = fh.readlines()
|
|
mode = None
|
|
colors = list(range(0, 16))
|
|
for ii in lines:
|
|
i = ii.rstrip()
|
|
if i[0:4] == '[cur':
|
|
mode = 'cursor'
|
|
elif i[0:4] == '[col':
|
|
mode = 'colors'
|
|
else:
|
|
if mode == 'cursor' and i[0:5] == 'color' :
|
|
x = i.split('=')
|
|
color256, color257 = x[1].split(' ')
|
|
elif mode == 'colors':
|
|
if i[0:4] == 'fore':
|
|
color258 = i.split('=')[1]
|
|
elif i[0:4] == 'back':
|
|
color259 = i.split('=')[1]
|
|
elif i[0:4] == 'regu':
|
|
index = int(i[7])
|
|
col = i.split('=')[1]
|
|
colors[index] = f'{col}'
|
|
elif i[0:4] == 'brig':
|
|
index = int(i[6]) + 8
|
|
col = i.split('=')[1]
|
|
colors[index] = f'{col}'
|
|
|
|
print(f"""-C #{colors[0]}@0 \
|
|
-C #{colors[1]}@1 \
|
|
-C #{colors[2]}@2 \
|
|
-C #{colors[3]}@3 \
|
|
-C #{colors[4]}@4 \
|
|
-C #{colors[5]}@5 \
|
|
-C #{colors[6]}@6 \
|
|
-C #{colors[7]}@7 \
|
|
-C #{colors[8]}@8 \
|
|
-C #{colors[9]}@9 \
|
|
-C #{colors[10]}@10 \
|
|
-C #{colors[11]}@11 \
|
|
-C #{colors[12]}@12 \
|
|
-C #{colors[13]}@13 \
|
|
-C #{colors[14]}@14 \
|
|
-C #{colors[15]}@15 \
|
|
-C #{color256}@256 \
|
|
-C #{color257}@257 \
|
|
-C #{color258}@258 \
|
|
-C #{color259}@259
|
|
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
ap = argparse.ArgumentParser()
|
|
ap.add_argument('-f','--filename',type=str,required=True)
|
|
main(ap.parse_args())
|