d8593d89c0
* Move the forum box colors into dedicated styles that are easier to override for the new theme colors. * Updated the themes so forums and comment thread background cards now match your chosen style. * Add yellow and orange theme variants.
30 lines
863 B
Go
30 lines
863 B
Go
package utility
|
|
|
|
import "code.nonshy.com/nonshy/website/pkg/config"
|
|
|
|
// StringInOptions constrains a string value (posted by the user) to only be one
|
|
// of the available values in the Option list enum. Returns the string if OK, or
|
|
// else the default string.
|
|
func StringInOptions(v string, options []config.Option, orDefault string) string {
|
|
for _, option := range options {
|
|
if v == option.Value {
|
|
return v
|
|
}
|
|
}
|
|
return orDefault
|
|
}
|
|
|
|
// StringInOptGroup constrains a string value (posted by the user) to only be one
|
|
// of the available values in the Option list enum. Returns the string if OK, or
|
|
// else the default string.
|
|
func StringInOptGroup(v string, options []config.OptGroup, orDefault string) string {
|
|
for _, group := range options {
|
|
for _, option := range group.Options {
|
|
if v == option.Value {
|
|
return v
|
|
}
|
|
}
|
|
}
|
|
return orDefault
|
|
}
|