diff options
author | Frédéric Guillot <fred@miniflux.net> | 2018-07-18 22:30:05 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-07-18 22:30:05 -0700 |
commit | a291d8a38b40569fdd1f00125ca0b29e4b9264f2 (patch) | |
tree | 13345ce7b413d9919521de258e60954467afcda0 /model/theme.go | |
parent | c1ab27172c0d82f9289aeb3402056f727bc473fd (diff) |
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
Diffstat (limited to 'model/theme.go')
-rw-r--r-- | model/theme.go | 12 |
1 files changed, 12 insertions, 0 deletions
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() { |