Files
bugsink/theme/templates/barest_base.html
Klaas van Schelven 9a6d453443 Fix 2 bare_base/barest_base mistakes re dark mode
* in 1abc30a760 the hardcoding of ="dark" (during development)
  was accidentally checked in; it never should have been.

* in e14b3eaaa6 I mixed up the bare*base templates. It's actually
  bare_base.html that's for 404/500 etc; barest_base is more bare
  visually (it's the box-based layout for login etc), but it doesn't
  need to be so careful not to use variables.

See #40
2025-07-08 17:04:38 +02:00

35 lines
1.2 KiB
HTML

{% load static tailwind_tags %}<!DOCTYPE html>{# copy of bare_base.html, but without even a menu bar #}
<html lang="en" data-theme="{% if user.is_authenticated %}{{ user.theme_preference }}{% else %}system{% endif %}">
<head>
<title>{% block title %}Bugsink{% endblock %}</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% tailwind_preload_css %}
{% tailwind_css %}
<script>
// System theme detection and switching
(function() {
const html = document.documentElement;
function applySystemTheme() {
if (document.documentElement.getAttribute('data-theme') === 'system') {
const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
html.setAttribute('data-theme', isDark ? 'dark' : 'light');
}
}
applySystemTheme();
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', applySystemTheme);
})();
</script>
</head>
<body class="dark:bg-slate-700 dark:text-slate-100">
<div id="content">
<div>
{% block content %}{% endblock %}
</div>
</div>
{% block extra_js %}{% endblock %}
</body>
</html>