sampler-fork/config/default.go

43 lines
719 B
Go
Raw Normal View History

2019-02-01 00:02:34 +00:00
package config
import (
2019-02-02 14:45:53 +00:00
"github.com/sqshq/sampler/console"
)
2019-02-01 00:02:34 +00:00
const (
defaultRefreshRateMs = 300
defaultTheme = console.ThemeDark
2019-02-01 00:02:34 +00:00
)
func (self *Config) setDefaultValues() {
if len(self.Theme) == 0 {
self.Theme = defaultTheme
}
for i, chart := range self.RunCharts {
if chart.RefreshRateMs == 0 {
chart.RefreshRateMs = defaultRefreshRateMs
}
self.RunCharts[i] = chart
}
}
func (config *Config) setDefaultLayout() {
}
func (config *Config) setDefaultColors() {
palette := console.GetPalette(config.Theme)
2019-02-01 00:02:34 +00:00
for i, chart := range config.RunCharts {
for j, item := range chart.Items {
if item.Color == 0 {
item.Color = palette.Colors[i+j]
chart.Items[j] = item
}
}
}
}