miniflux/model/theme.go

28 lines
626 B
Go
Raw Normal View History

2017-11-20 06:10:04 +01:00
// Copyright 2017 Frédéric Guillot. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package model
2017-12-13 06:48:13 +01:00
import "github.com/miniflux/miniflux/errors"
2017-11-25 21:44:32 +01:00
2017-11-28 06:30:04 +01:00
// Themes returns the list of available themes.
func Themes() map[string]string {
2017-11-20 06:10:04 +01:00
return map[string]string{
2018-06-19 06:57:30 +02:00
"default": "Default",
"black": "Black",
"sansserif": "Sans-Serif",
2017-11-20 06:10:04 +01:00
}
}
2017-11-25 21:44:32 +01:00
// ValidateTheme validates theme value.
func ValidateTheme(theme string) error {
2017-11-28 06:30:04 +01:00
for key := range Themes() {
2017-11-25 21:44:32 +01:00
if key == theme {
return nil
}
}
2017-12-25 03:04:34 +01:00
return errors.NewLocalizedError("Invalid theme")
2017-11-25 21:44:32 +01:00
}