mirror of
https://github.com/grafana/grafana.git
synced 2025-01-05 21:53:45 -06:00
21 lines
336 B
Go
21 lines
336 B
Go
|
package models
|
||
|
|
||
|
import "errors"
|
||
|
|
||
|
type Theme string
|
||
|
|
||
|
const (
|
||
|
ThemeLight Theme = "light"
|
||
|
ThemeDark Theme = "dark"
|
||
|
)
|
||
|
|
||
|
func ParseTheme(str string) (Theme, error) {
|
||
|
switch str {
|
||
|
case string(ThemeLight):
|
||
|
return ThemeLight, nil
|
||
|
case string(ThemeDark):
|
||
|
return ThemeDark, nil
|
||
|
}
|
||
|
return ThemeDark, errors.New("unknown theme " + str)
|
||
|
}
|