21 lines
600 B
Python
21 lines
600 B
Python
|
#! /usr/bin/env python
|
||
|
|
||
|
import json
|
||
|
import os
|
||
|
|
||
|
themes = []
|
||
|
for dirname in sorted(os.listdir('static')):
|
||
|
config = os.path.join('static', dirname, 'config.json')
|
||
|
if not os.path.exists(config):
|
||
|
continue
|
||
|
theme = json.load(open(os.path.join('static', dirname, 'config.json')))
|
||
|
theme['id'] = dirname
|
||
|
if not 'variables' in theme:
|
||
|
theme['variables'] = {}
|
||
|
if not theme['variables'].get('css_variant'):
|
||
|
theme['variables']['css_variant'] = dirname
|
||
|
themes.append(theme)
|
||
|
|
||
|
with open('themes.json', 'w') as fd:
|
||
|
json.dump(themes, fd, indent=2, sort_keys=True)
|