aboutsummaryrefslogtreecommitdiff
path: root/templates/base.qtpl
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2025-10-26 18:03:15 +0100
committerGabriel A. Giovanini <mail@gabrielgio.me>2025-10-26 22:38:48 +0100
commit358d4691f44fbee5f388b68458f41f4038464a0b (patch)
tree26adce0cd4b7d7dd523c145eb7ee308d870ceaff /templates/base.qtpl
parentb18a5b43be89aeb1a6c3a7fa3eaa3176e2af095a (diff)
downloadcerrado-358d4691f44fbee5f388b68458f41f4038464a0b.tar.gz
cerrado-358d4691f44fbee5f388b68458f41f4038464a0b.tar.bz2
cerrado-358d4691f44fbee5f388b68458f41f4038464a0b.zip
feat: Adapt scss to support dark mode
Diffstat (limited to 'templates/base.qtpl')
-rw-r--r--templates/base.qtpl6
1 files changed, 5 insertions, 1 deletions
diff --git a/templates/base.qtpl b/templates/base.qtpl
index db9deee..b3df94a 100644
--- a/templates/base.qtpl
+++ b/templates/base.qtpl
@@ -54,12 +54,13 @@ Page {
Page prints a page implementing Page interface.
{% func PageTemplate(p Page, ctx context.Context) %}
<!DOCTYPE html>
-<html lang="en">
+<html lang="en" data-bs-theme="light">
<head>
<meta charset="utf-8">
<link rel="icon" href="data:,">
<title>{%= p.Title(ctx) %}</title>
<link rel="stylesheet" href="/static/main{%s Slug %}.css">
+ <html data-bs-theme="dark">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
@@ -70,5 +71,8 @@ Page prints a page implementing Page interface.
</div>
</body>
{%= p.Script(ctx) %}
+ <script>
+ function a(){const e=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.setAttribute("data-bs-theme",e?"dark":"light")}a(),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",a);
+ </script>
</html>
{% endfunc %}