pint/tools/cgGen.py

27 lines
1.1 KiB
Python
Raw Permalink Normal View History

2022-07-22 05:48:00 +00:00
with open("schemeGroups.js", "a") as f:
x = open("colors.txt", "r")
prev_line = ""
prevComparison = ""
2022-07-21 06:26:10 +00:00
groupNumber = 0
2022-07-21 05:50:52 +00:00
2022-07-21 06:26:10 +00:00
for current_line in x:
value = current_line.split("=>")[0].strip()
varName = current_line.split("=>")[0].strip().replace("#", "")
2022-07-22 05:48:23 +00:00
if prev_line.split("=>")[0].strip() != current_line.split(
"=>")[0].strip():
2022-07-21 06:26:10 +00:00
if prevComparison != value[0:7]:
groupNumber += 1
alphaValue = 0
2022-07-22 05:48:23 +00:00
f.write("]\n\n// color group: " + str(groupNumber) +
" | default color: " + value + "\nexport var cg" +
str(groupNumber) + "_" + varName + " = [\n")
2022-07-21 06:26:10 +00:00
else:
2022-07-22 05:48:23 +00:00
f.write("]\n\n// color group: " + str(groupNumber) +
" | default color: " + value + "\nexport var cg" +
str(groupNumber) + "a_" + value[7:9] + " = [\n")
2022-07-21 06:26:10 +00:00
f.write('"' + current_line.split("=>")[1].strip() + '",\n')
prev_line = current_line
prevComparison = value[0:7]
2022-07-21 05:50:52 +00:00
2022-07-21 06:26:10 +00:00
x.close()