From a291d8a38b40569fdd1f00125ca0b29e4b9264f2 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Wed, 18 Jul 2018 22:30:05 -0700 Subject: Improve themes handling - Store user theme in session - Logged out users will keep their theme - Add theme background color to web manifest and meta tag --- model/theme.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'model/theme.go') diff --git a/model/theme.go b/model/theme.go index 5d32df4..f58f91c 100644 --- a/model/theme.go +++ b/model/theme.go @@ -15,6 +15,18 @@ func Themes() map[string]string { } } +// ThemeColor returns the color for the address bar or/and the browser color. +// https://developer.mozilla.org/en-US/docs/Web/Manifest#theme_color +// https://developers.google.com/web/tools/lighthouse/audits/address-bar +func ThemeColor(theme string) string { + switch theme { + case "black": + return "#222" + default: + return "#fff" + } +} + // ValidateTheme validates theme value. func ValidateTheme(theme string) error { for key := range Themes() { -- cgit v1.2.3