mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 17:43:35 -06:00
35 lines
613 B
Go
35 lines
613 B
Go
|
package pref
|
||
|
|
||
|
type ThemeDTO struct {
|
||
|
ID string `json:"id"`
|
||
|
Type string `json:"type"`
|
||
|
IsExtra bool `json:"isExtra"`
|
||
|
}
|
||
|
|
||
|
var themes = []ThemeDTO{
|
||
|
{ID: "light", Type: "light"},
|
||
|
{ID: "dark", Type: "dark"},
|
||
|
{ID: "system", Type: "dark"},
|
||
|
{ID: "midnight", Type: "dark", IsExtra: true},
|
||
|
{ID: "blue-night", Type: "dark", IsExtra: true},
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|