Toggle light and dark modes + header color
This commit is contained in:
parent
d40bc51101
commit
b7f0d6f8b2
6 changed files with 118 additions and 10 deletions
|
|
@ -17,6 +17,7 @@ type TemplatesGlobals struct {
|
|||
UserFullname string
|
||||
UserIsAdmin bool
|
||||
TimeStart time.Time
|
||||
ColorMode string
|
||||
}
|
||||
|
||||
func TemplatesMiddleware(c *fiber.Ctx) error {
|
||||
|
|
@ -28,6 +29,12 @@ func TemplatesMiddleware(c *fiber.Ctx) error {
|
|||
return err
|
||||
}
|
||||
|
||||
globals.ColorMode = "auto"
|
||||
colorMode := sess.Get("color-mode")
|
||||
if colorMode == "dark" || colorMode == "light" {
|
||||
globals.ColorMode = colorMode.(string)
|
||||
}
|
||||
|
||||
userid := sess.Get("userid")
|
||||
if userid != nil {
|
||||
switch userid.(type) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue