forked from doda-zz/github-language-colors
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
24 lines (19 loc) · 829 Bytes
/
build.py
File metadata and controls
24 lines (19 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import subprocess
import yaml
import json
import os
replace_names = {
'C++': 'cpp',
'C#': 'C Sharp'
}
subprocess.call(['wget', 'https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml', '-q'])
with open('languages.yml') as f:
colors = yaml.load(f)
os.remove('languages.yml')
colors = dict((replace_names.get(name, name), color['color']) for name, color in colors.items() if 'color' in color)
with open('colors.json', 'w') as f:
json.dump(colors, f, indent=4)
with open('README.rst', 'w') as f:
f.write('A mapping of which colors github uses to represent different programming languages in their "Languages" tab on each repository.')
f.write('\n\n')
f.write('\n'.join('.. image:: http://www.placehold.it/200/%s/ffffff&text=%s' % (v[1:], k) for k, v in colors.items()))