mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-22 13:47:42 +00:00
dark mode at root fixes #75
This commit is contained in:
parent
65c7d98b5a
commit
0508b95e24
|
@ -327,6 +327,11 @@ func Render(w http.ResponseWriter, templateName string, state State) {
|
|||
func GetRoot(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||
data := make(map[string]any)
|
||||
data["Title"] = r.Host
|
||||
if dark := getCookie(r, "Dark"); dark != "" {
|
||||
data["Dark"] = dark != "0"
|
||||
} else {
|
||||
data["Dark"] = os.Getenv("DARK") != ""
|
||||
}
|
||||
tmpl, err := GetTemplate("root.html")
|
||||
if err != nil {
|
||||
fmt.Println("execute fail", err)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<link rel="stylesheet" href="/_/static/style.css?v=7">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
</head>
|
||||
<body>
|
||||
<body{{ if .Dark }} class="dark"{{end}}>
|
||||
<nav>
|
||||
<div class="spacer"></div>
|
||||
<span class="title">{{ .Title }}</span>
|
||||
|
|
Loading…
Reference in a new issue