Skip to content

Instantly share code, notes, and snippets.

@cmoates
Created April 2, 2019 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmoates/cb9c67fee3d0b038e2f4178e4161b5f0 to your computer and use it in GitHub Desktop.
Save cmoates/cb9c67fee3d0b038e2f4178e4161b5f0 to your computer and use it in GitHub Desktop.
Add the color ID of Boundless palette colors to the color description for in game sorting ease
#!/usr/bin/python
import json
newdata={}
with open('english.json') as json_file:
data = json.load(json_file)
for key, value in data.iteritems():
if key.startswith('GUI_PALETTECOLOR_'):
number = key.split('_', 2)
number = number[2]
newdata[key]='%s %s'%(value, number)
else:
newdata[key]=value
with open('englishnumbers.json','w') as outfile:
json.dump(newdata,outfile, indent=4, sort_keys=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment