diff options
| author | Gabriel Schneider <[email protected]> | 2026-08-01 16:18:19 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-01 18:21:40 -0300 |
| commit | 151ea12251ed876aa87bb486da1bc337e25369e9 (patch) | |
| tree | 0363d90b5df6fc8b17b1737ef2793ba3825ba4d4 /vrsite/templates/layout.tmpl | |
| parent | 8ec4e135e318c7799b2576a8729493c063da4a97 (diff) | |
| download | notevi-151ea12251ed876aa87bb486da1bc337e25369e9.tar.gz notevi-151ea12251ed876aa87bb486da1bc337e25369e9.zip | |
Diffstat (limited to 'vrsite/templates/layout.tmpl')
| -rw-r--r-- | vrsite/templates/layout.tmpl | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/vrsite/templates/layout.tmpl b/vrsite/templates/layout.tmpl index 9bc9ddd..268b5b6 100644 --- a/vrsite/templates/layout.tmpl +++ b/vrsite/templates/layout.tmpl @@ -4,12 +4,20 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>{{.Title}}</title> +<link rel="stylesheet" href="{{.Href "asset" "style.css"}}"> <script> +// the theme is worn before the first paint. A theme that is not one of the +// two the site was built with lives in themes.css, so pull that in too — +// from here, after style.css, so its :root block is the one that wins. {const d = document.documentElement, t = localStorage.getItem("vrsite-theme"); if (t && t !== "system") d.dataset.theme = t; + if (t && !/^(system|dark|light)$/.test(t)) { + const l = document.createElement("link"); + l.rel = "stylesheet"; l.id = "themescss"; l.href = "{{.Href "asset" "themes.css"}}"; + document.head.append(l); + } d.dataset.mode = localStorage.getItem("vrsite-mode") || "trace";} </script> -<link rel="stylesheet" href="{{.Href "asset" "style.css"}}"> {{if .Live}}<script src="{{.Href "asset" "htmx.min.js"}}"></script>{{end}} <script src="{{.Href "asset" "app.js"}}" defer></script> </head> @@ -35,11 +43,20 @@ <a href="{{.Href "files"}}">files</a>{{if .Live}} · <a href="{{.Href "jj"}}">jj</a>{{end}} </span> - <select id="themesel" aria-label="color scheme"> - <option value="system">system</option> - <option value="dark">dark</option> - <option value="light">light</option> - </select> + <div class="themepick" id="themepick" + data-js="{{.Href "asset" "themes.js"}}" data-css="{{.Href "asset" "themes.css"}}" + data-dark="{{.Site.Theme.Name}}" data-light="{{.Site.Light.Name}}" + data-darkid="{{.Site.Theme.ID}}" data-lightid="{{.Site.Light.ID}}"> + <button type="button" id="themebtn" aria-haspopup="listbox" aria-expanded="false" + title="theme — every one installed here (T)">theme</button> + <div class="thememenu" id="thememenu" hidden> + <input id="themefind" type="search" placeholder="filter themes…" aria-label="filter themes" + role="combobox" aria-controls="themelist" aria-autocomplete="list" + autocomplete="off" spellcheck="false"> + <ul id="themelist" role="listbox" aria-label="themes"></ul> + <p class="meta hint">↑↓ preview · enter keeps · esc puts it back</p> + </div> + </div> </footer> </nav> @@ -47,6 +64,7 @@ {{if .Err}}<p class="err">{{.Err}}</p>{{end}} {{if eq .Kind "file"}}{{template "page-file" .}} {{else if eq .Kind "notes"}}{{template "page-notes" .}} +{{else if eq .Kind "note"}}{{template "page-note" .}} {{else if eq .Kind "files"}}{{template "page-files" .}} {{else if eq .Kind "jj"}}{{template "page-jj" .}} {{else if eq .Kind "change"}}{{template "page-change" .}} |
