aboutsummaryrefslogtreecommitdiffhomepage
path: root/model/theme.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2017-11-25 12:44:32 -0800
committerGravatar Frédéric Guillot <fred@miniflux.net>2017-11-25 12:44:32 -0800
commitec0f642d5d3ec636b158b5fb0125f3a28ff9bf37 (patch)
tree4f146de44b0f0d8568470b99822dbfcd6c24cc2f /model/theme.go
parent142e8b3e0c94757585005cd00fc9ed24afe43f81 (diff)
Add integration tests for users
Diffstat (limited to 'model/theme.go')
-rw-r--r--model/theme.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/model/theme.go b/model/theme.go
index bcbb23a..c9bbc05 100644
--- a/model/theme.go
+++ b/model/theme.go
@@ -4,6 +4,8 @@
package model
+import "github.com/miniflux/miniflux2/errors"
+
// GetThemes returns the list of available themes.
func GetThemes() map[string]string {
return map[string]string{
@@ -11,3 +13,14 @@ func GetThemes() map[string]string {
"black": "Black",
}
}
+
+// ValidateTheme validates theme value.
+func ValidateTheme(theme string) error {
+ for key := range GetThemes() {
+ if key == theme {
+ return nil
+ }
+ }
+
+ return errors.NewLocalizedError("Invalid theme.")
+}