c95e3da2d5
* convert all theme files to json * automatically discover extra themes in go backend * use zod * error tidy up * error tidy up p2 * generate theme json schema from zod * generate theme list at build time, don't do it at runtime * make name and id required in the theme schema
29 lines
437 B
Go
29 lines
437 B
Go
//go:generate go run generate_themes.go
|
|
|
|
package pref
|
|
|
|
type ThemeDTO struct {
|
|
ID string `json:"id"`
|
|
Type string `json:"type"`
|
|
IsExtra bool `json:"isExtra"`
|
|
}
|
|
|
|
func GetThemeByID(id string) *ThemeDTO {
|
|
for _, theme := range themes {
|
|
if theme.ID == id {
|
|
return &theme
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func IsValidThemeID(id string) bool {
|
|
for _, theme := range themes {
|
|
if theme.ID == id {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|