aboutsummaryrefslogtreecommitdiff
path: root/templates
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
parentb18a5b43be89aeb1a6c3a7fa3eaa3176e2af095a (diff)
downloadcerrado-358d4691f44fbee5f388b68458f41f4038464a0b.tar.gz
cerrado-358d4691f44fbee5f388b68458f41f4038464a0b.tar.bz2
cerrado-358d4691f44fbee5f388b68458f41f4038464a0b.zip
feat: Adapt scss to support dark mode
Diffstat (limited to 'templates')
-rw-r--r--templates/base.qtpl6
-rw-r--r--templates/base.qtpl.go44
2 files changed, 29 insertions, 21 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 %}
diff --git a/templates/base.qtpl.go b/templates/base.qtpl.go
index 796538e..dce4cbc 100644
--- a/templates/base.qtpl.go
+++ b/templates/base.qtpl.go
@@ -98,7 +98,7 @@ func StreamPageTemplate(qw422016 *qt422016.Writer, p Page, ctx context.Context)
//line templates/base.qtpl:55
qw422016.N().S(`
<!DOCTYPE html>
-<html lang="en">
+<html lang="en" data-bs-theme="light">
<head>
<meta charset="utf-8">
<link rel="icon" href="data:,">
@@ -112,55 +112,59 @@ func StreamPageTemplate(qw422016 *qt422016.Writer, p Page, ctx context.Context)
qw422016.E().S(Slug)
//line templates/base.qtpl:62
qw422016.N().S(`.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>
<body>
`)
-//line templates/base.qtpl:67
+//line templates/base.qtpl:68
p.StreamNavbar(qw422016, ctx)
-//line templates/base.qtpl:67
+//line templates/base.qtpl:68
qw422016.N().S(`
<div class="container">
`)
-//line templates/base.qtpl:69
+//line templates/base.qtpl:70
p.StreamContent(qw422016, ctx)
-//line templates/base.qtpl:69
+//line templates/base.qtpl:70
qw422016.N().S(`
</div>
</body>
`)
-//line templates/base.qtpl:72
+//line templates/base.qtpl:73
p.StreamScript(qw422016, ctx)
-//line templates/base.qtpl:72
+//line templates/base.qtpl:73
qw422016.N().S(`
+ <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>
`)
-//line templates/base.qtpl:74
+//line templates/base.qtpl:78
}
-//line templates/base.qtpl:74
+//line templates/base.qtpl:78
func WritePageTemplate(qq422016 qtio422016.Writer, p Page, ctx context.Context) {
-//line templates/base.qtpl:74
+//line templates/base.qtpl:78
qw422016 := qt422016.AcquireWriter(qq422016)
-//line templates/base.qtpl:74
+//line templates/base.qtpl:78
StreamPageTemplate(qw422016, p, ctx)
-//line templates/base.qtpl:74
+//line templates/base.qtpl:78
qt422016.ReleaseWriter(qw422016)
-//line templates/base.qtpl:74
+//line templates/base.qtpl:78
}
-//line templates/base.qtpl:74
+//line templates/base.qtpl:78
func PageTemplate(p Page, ctx context.Context) string {
-//line templates/base.qtpl:74
+//line templates/base.qtpl:78
qb422016 := qt422016.AcquireByteBuffer()
-//line templates/base.qtpl:74
+//line templates/base.qtpl:78
WritePageTemplate(qb422016, p, ctx)
-//line templates/base.qtpl:74
+//line templates/base.qtpl:78
qs422016 := string(qb422016.B)
-//line templates/base.qtpl:74
+//line templates/base.qtpl:78
qt422016.ReleaseByteBuffer(qb422016)
-//line templates/base.qtpl:74
+//line templates/base.qtpl:78
return qs422016
-//line templates/base.qtpl:74
+//line templates/base.qtpl:78
}