Update web/templates/base.html

This commit is contained in:
Joshua Laymon 2025-09-06 03:19:19 +00:00
parent d7a84978d6
commit ee6faf3a11

View File

@ -1,6 +1,6 @@
{% load static %} {% load static %}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en" data-theme="{{ request.session.theme|default:'classic' }}">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>{% block title %}Illustrations{% endblock %}</title> <title>{% block title %}Illustrations{% endblock %}</title>
@ -10,13 +10,14 @@
{# === THEME SYSTEM (BEGIN) === #} {# === THEME SYSTEM (BEGIN) === #}
<link rel="stylesheet" href="{% static 'css/theme-base.css' %}"> <link rel="stylesheet" href="{% static 'css/theme-base.css' %}">
<link id="theme-css" rel="stylesheet" <link id="theme-css" rel="stylesheet"
href="{% static 'themes/' %}{{ request.session.theme|default:'midnight' }}.css"> href="{% static 'themes/' %}{{ request.session.theme|default:'classic' }}.css">
<script> <script>
// Early apply from localStorage to prevent flash if a user-selected theme exists // Early apply from localStorage to prevent flash if a user-selected theme exists
(function () { (function () {
try { try {
var stored = localStorage.getItem('theme'); var stored = localStorage.getItem('theme');
if (stored) { if (stored) {
document.documentElement.setAttribute('data-theme', stored);
document.getElementById('theme-css').href = '{% static "themes/" %}' + stored + '.css'; document.getElementById('theme-css').href = '{% static "themes/" %}' + stored + '.css';
} }
} catch (e) {} } catch (e) {}