diff options
Diffstat (limited to 'templates/base.qtpl')
| -rw-r--r-- | templates/base.qtpl | 6 |
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 %} |
