1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

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
This commit is contained in:
Frédéric Guillot 2019-09-21 19:10:08 -07:00 committed by Frédéric Guillot
parent d610d091fe
commit afe1faf214
18 changed files with 569 additions and 334 deletions

View file

@ -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"

View file

@ -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`)
}

View file

@ -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`)
}