User:Ch4zm/Initial MediaWiki Setup/Make Common CSS

From Golly.Life Wiki

Python script to generate the sections of MediaWiki:Common.css that specify CSS classes for each Golly team:

import requests
import json

teams = requests.get('https://api.golly.life/teams').json()

for team in teams:
    abbr = team['teamAbbr'].lower()
    color = team['teamColor']
    css_template = f"""
.{abbr}_fg {{
    color: {color} !important;
}}
.{abbr}_border {{
    border: medium solid {color} !important;
}}
.{abbr}_bg {{
    background-color: {color} !important;
}}
"""
    print(css_template)