v1
This commit is contained in:
23
main.py
Normal file
23
main.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import sys
|
||||
import csv
|
||||
|
||||
def main(input, output):
|
||||
|
||||
with open(input, newline='') as csvfile, open(output, "w") as gpl:
|
||||
code_reader = csv.reader(csvfile, delimiter=',')
|
||||
next(code_reader)
|
||||
|
||||
gpl.write(f"GIMP Palette\n")
|
||||
gpl.write(f"Name: Swatchos\n")
|
||||
gpl.write(f"Columns: 0\n")
|
||||
|
||||
for row in code_reader:
|
||||
hex = row[1].lstrip('#')
|
||||
r = int(hex[0:2], 16)
|
||||
g = int(hex[2:4], 16)
|
||||
b = int(hex[4:6], 16)
|
||||
|
||||
gpl.write(f"{r} {g} {b} {row[0]}\n")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1], sys.argv[2])
|
||||
Reference in New Issue
Block a user