diff options
author | Frédéric Guillot <fred@miniflux.net> | 2019-09-21 19:10:08 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2019-09-21 20:04:42 -0700 |
commit | afe1faf2141ef9cd3a5564fa33646b821ae5162b (patch) | |
tree | ca3fbbea8236154aabeedd54c05775e7f4fcbf35 /model | |
parent | d610d091fed6dbac3a7ae7e6a67e6e8455b77755 (diff) |
Add theme variants
- Use CSS variables instead of inherence
- Rename default theme to "Light - Serif"
- Rename Black theme to "Dark - Serif"
- Rename "Sans-Serif" theme to "Light - Sans Serif"
- Add "System" theme that use system preferences: Dark or Light
- Add Serif and Sans-Serif variants for each color theme
Diffstat (limited to 'model')
-rw-r--r-- | model/theme.go | 11 | ||||
-rw-r--r-- | model/theme_test.go | 2 | ||||
-rw-r--r-- | model/user_test.go | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/model/theme.go b/model/theme.go index 9d379fd..d9f0763 100644 --- a/model/theme.go +++ b/model/theme.go @@ -9,9 +9,12 @@ import "miniflux.app/errors" // Themes returns the list of available themes. func Themes() map[string]string { return map[string]string{ - "default": "Default", - "black": "Black", - "sansserif": "Sans-Serif", + "light_serif": "Light - Serif", + "light_sans_serif": "Light - Sans Serif", + "dark_serif": "Dark - Serif", + "dark_sans_serif": "Dark - Sans Serif", + "system_serif": "System - Serif", + "system_sans_serif": "System - Sans Serif", } } @@ -20,7 +23,7 @@ func Themes() map[string]string { // https://developers.google.com/web/tools/lighthouse/audits/address-bar func ThemeColor(theme string) string { switch theme { - case "black": + case "dark_serif", "dark_sans_serif": return "#222" default: return "#fff" diff --git a/model/theme_test.go b/model/theme_test.go index 0e710db..30d7669 100644 --- a/model/theme_test.go +++ b/model/theme_test.go @@ -7,7 +7,7 @@ package model // import "miniflux.app/model" import "testing" func TestValidateTheme(t *testing.T) { - for _, status := range []string{"default", "black", "sansserif"} { + for _, status := range []string{"light_serif", "dark_sans_serif", "system_serif"} { if err := ValidateTheme(status); err != nil { t.Error(`A valid theme should not generate any error`) } diff --git a/model/user_test.go b/model/user_test.go index d560e35..9954727 100644 --- a/model/user_test.go +++ b/model/user_test.go @@ -39,7 +39,7 @@ func TestValidateUserModification(t *testing.T) { t.Error(`There is no changes, so we should not have an error`) } - user = &User{Theme: "default"} + user = &User{Theme: "system_serif"} if err := user.ValidateUserModification(); err != nil { t.Error(`A valid theme should not generate any errors`) } |