diff options
| author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2025-11-01 17:49:20 +0100 |
|---|---|---|
| committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2025-11-01 17:49:20 +0100 |
| commit | 5dd940eb52b40c78a2078ed0a02440e84bee0306 (patch) | |
| tree | 81e6b5a148c42a5687a0fde0a77001b5ab81cfb4 /templates/base.qtpl.go | |
| parent | ed1fc6854a634f7fcff7d1a500c40e7502031ea7 (diff) | |
| download | cerrado-5dd940eb52b40c78a2078ed0a02440e84bee0306.tar.gz cerrado-5dd940eb52b40c78a2078ed0a02440e84bee0306.tar.bz2 cerrado-5dd940eb52b40c78a2078ed0a02440e84bee0306.zip | |
feat: Write css dark/light theme on standalone url
This will allow tho write both themes into the same css file.
Also mend with the css generate by chroma so it can be nested.
Diffstat (limited to 'templates/base.qtpl.go')
| -rw-r--r-- | templates/base.qtpl.go | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/templates/base.qtpl.go b/templates/base.qtpl.go index dce4cbc..783de2c 100644 --- a/templates/base.qtpl.go +++ b/templates/base.qtpl.go @@ -8,16 +8,14 @@ package templates //line templates/base.qtpl:3 -import "context" - -//line templates/base.qtpl:4 -import "strconv" +import ( + "context" + "strconv" + "time" //line templates/base.qtpl:4 -//line templates/base.qtpl:5 -import "time" + //line templates/base.qtpl:5 + //line templates/base.qtpl:7 -//line templates/base.qtpl:7 -import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" @@ -112,59 +110,60 @@ func StreamPageTemplate(qw422016 *qt422016.Writer, p Page, ctx context.Context) qw422016.E().S(Slug) //line templates/base.qtpl:62 qw422016.N().S(`.css"> + <link rel="stylesheet" href="/static/theme"> <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:68 +//line templates/base.qtpl:70 p.StreamNavbar(qw422016, ctx) -//line templates/base.qtpl:68 +//line templates/base.qtpl:70 qw422016.N().S(` <div class="container"> `) -//line templates/base.qtpl:70 +//line templates/base.qtpl:72 p.StreamContent(qw422016, ctx) -//line templates/base.qtpl:70 +//line templates/base.qtpl:72 qw422016.N().S(` </div> </body> `) -//line templates/base.qtpl:73 +//line templates/base.qtpl:75 p.StreamScript(qw422016, ctx) -//line templates/base.qtpl:73 +//line templates/base.qtpl:75 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:78 +//line templates/base.qtpl:80 } -//line templates/base.qtpl:78 +//line templates/base.qtpl:80 func WritePageTemplate(qq422016 qtio422016.Writer, p Page, ctx context.Context) { -//line templates/base.qtpl:78 +//line templates/base.qtpl:80 qw422016 := qt422016.AcquireWriter(qq422016) -//line templates/base.qtpl:78 +//line templates/base.qtpl:80 StreamPageTemplate(qw422016, p, ctx) -//line templates/base.qtpl:78 +//line templates/base.qtpl:80 qt422016.ReleaseWriter(qw422016) -//line templates/base.qtpl:78 +//line templates/base.qtpl:80 } -//line templates/base.qtpl:78 +//line templates/base.qtpl:80 func PageTemplate(p Page, ctx context.Context) string { -//line templates/base.qtpl:78 +//line templates/base.qtpl:80 qb422016 := qt422016.AcquireByteBuffer() -//line templates/base.qtpl:78 +//line templates/base.qtpl:80 WritePageTemplate(qb422016, p, ctx) -//line templates/base.qtpl:78 +//line templates/base.qtpl:80 qs422016 := string(qb422016.B) -//line templates/base.qtpl:78 +//line templates/base.qtpl:80 qt422016.ReleaseByteBuffer(qb422016) -//line templates/base.qtpl:78 +//line templates/base.qtpl:80 return qs422016 -//line templates/base.qtpl:78 +//line templates/base.qtpl:80 } |
