theme.go 626 B

123456789101112131415161718192021222324252627
  1. // Copyright 2017 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package model
  5. import "github.com/miniflux/miniflux/errors"
  6. // Themes returns the list of available themes.
  7. func Themes() map[string]string {
  8. return map[string]string{
  9. "default": "Default",
  10. "black": "Black",
  11. "sansserif": "Sans-Serif",
  12. }
  13. }
  14. // ValidateTheme validates theme value.
  15. func ValidateTheme(theme string) error {
  16. for key := range Themes() {
  17. if key == theme {
  18. return nil
  19. }
  20. }
  21. return errors.NewLocalizedError("Invalid theme")
  22. }