~hristoast/mousikofidi

5fcec8577fb751f2cd4363dd7ce0b52a849d710a — Hristos N. Triantafillou 9 months ago 32edfb5
Plug in the terminal theme, dehardcode themes in general
2 files changed, 13 insertions(+), 3 deletions(-)

M mousikofidi/mousikofidi.py
M mousikofidi/templates/settings.html
M mousikofidi/mousikofidi.py => mousikofidi/mousikofidi.py +10 -0
@@ 44,6 44,7 @@ THEMES = {
    "dark": "/css/water/dark.standalone",
    "light": "/css/water/light.standalone",
    "nes": "/css/nes/nes",
    "terminal": "/css/terminal",
}

try:


@@ 1119,6 1120,15 @@ def serve_file(path):
@app.route("/settings")
def settings():
    c = request_context(app.fidiConfig)

    themes = []
    for theme in THEMES.keys():
        if theme == "nes":
            themes.append({"name": theme, "proper": theme.upper()})
        else:
            themes.append({"name": theme, "proper": theme.capitalize()})

    c["themes"] = themes
    c["page_name"] = "Settings"
    return render_template("settings.html", **c)


M mousikofidi/templates/settings.html => mousikofidi/templates/settings.html +3 -3
@@ 6,9 6,9 @@
  <form class="center" id="theme-picker" action="{{ url_for('.settings_edit') }}" method="post">
    <label>{% if icons %}<i class="fas fa-palette"></i> {% endif %}Select your theme:
      <select class="center" name="theme">
        <option value="dark"{% if "dark" in theme %} selected{% endif %}>Dark</option>
        <option value="light"{% if "light" in theme %} selected{% endif %}>Light</option>
        <option value="nes"{% if "nes" in theme %} selected{% endif %}>NES</option>
        {% for t in themes %}
          <option value="{{ t.name }}"{% if t.name in theme %} selected{% endif %}>{{ t.proper }}</option>
        {% endfor %}
      </select>
      <input style="margin:0 auto; margin-top:10px;" class="center" type="submit" value="Submit">
    </label>