carousel palette selection, added default colors
This commit is contained in:
parent
687e6f098e
commit
bd3ed07a5b
36
config.yml
36
config.yml
|
@ -1,4 +1,3 @@
|
|||
theme: dark
|
||||
runcharts:
|
||||
- title: SEARCH ENGINE RESPONSE TIME (sec)
|
||||
precision: 3
|
||||
|
@ -8,16 +7,17 @@ runcharts:
|
|||
size:
|
||||
w: 30
|
||||
h: 20
|
||||
legend:
|
||||
enabled: true
|
||||
details: true
|
||||
items:
|
||||
- script: curl -o /dev/null -s -w '%{time_total}' https://www.google.com/
|
||||
label: GOOGLE
|
||||
- script: curl -o /dev/null -s -w '%{time_total}' https://search.yahoo.com/
|
||||
label: YAHOO
|
||||
- script: curl -o /dev/null -s -w '%{time_total}' https://www.bing.com/
|
||||
label: BING
|
||||
- label: GOOGLE
|
||||
script: curl -o /dev/null -s -w '%{time_total}' https://www.google.com
|
||||
- label: YAHOO
|
||||
script: curl -o /dev/null -s -w '%{time_total}' https://search.yahoo.com
|
||||
- label: YANDEX
|
||||
script: curl -o /dev/null -s -w '%{time_total}' https://yandex.com
|
||||
- label: BING
|
||||
script: curl -o /dev/null -s -w '%{time_total}' https://www.bing.com
|
||||
- label: DDGO
|
||||
script: curl -o /dev/null -s -w '%{time_total}' https://duckduckgo.com
|
||||
- title: SEARCH ENGINE RESPONSE TIME 2 (sec)
|
||||
refresh-rate-ms: 5000
|
||||
position:
|
||||
|
@ -30,12 +30,12 @@ runcharts:
|
|||
enabled: true
|
||||
details: false
|
||||
items:
|
||||
- script: curl -o /dev/null -s -w '%{time_total}' https://www.google.com/
|
||||
label: GOOGLE
|
||||
- script: curl -o /dev/null -s -w '%{time_total}' https://search.yahoo.com/
|
||||
label: YAHOO
|
||||
- script: curl -o /dev/null -s -w '%{time_total}' https://www.bing.com/
|
||||
label: BING
|
||||
- label: GOOGLE
|
||||
script: curl -o /dev/null -s -w '%{time_total}' https://www.google.com
|
||||
- label: YAHOO
|
||||
script: curl -o /dev/null -s -w '%{time_total}' https://search.yahoo.com
|
||||
- label: BING
|
||||
script: curl -o /dev/null -s -w '%{time_total}' https://www.bing.com
|
||||
- title: MONGO COLLECTIONS COUNT
|
||||
position:
|
||||
w: 15
|
||||
|
@ -44,5 +44,5 @@ runcharts:
|
|||
w: 15
|
||||
h: 10
|
||||
items:
|
||||
- script: mongo --quiet --host=localhost blog --eval "db.getCollection('post').find({}).size()"
|
||||
label: POSTS
|
||||
- label: POSTS
|
||||
script: mongo --quiet --host=localhost blog --eval "db.getCollection('post').find({}).size()"
|
||||
|
|
|
@ -41,17 +41,18 @@ func (c *Config) setDefaultValues() {
|
|||
}
|
||||
|
||||
func (c *Config) setDefaultLayout() {
|
||||
|
||||
// TODO auto-arrange components
|
||||
}
|
||||
|
||||
func (c *Config) setDefaultColors() {
|
||||
|
||||
palette := console.GetPalette(*c.Theme)
|
||||
colorsCount := len(palette.Colors)
|
||||
|
||||
for i, chart := range c.RunCharts {
|
||||
for _, chart := range c.RunCharts {
|
||||
for j, item := range chart.Items {
|
||||
if item.Color == nil {
|
||||
item.Color = &palette.Colors[i+j] // TODO handle out of range case
|
||||
item.Color = &palette.Colors[j%colorsCount]
|
||||
chart.Items[j] = item
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,10 +16,13 @@ const (
|
|||
ColorOlive ui.Color = 178
|
||||
ColorDeepSkyBlue ui.Color = 39
|
||||
ColorDeepPink ui.Color = 198
|
||||
ColorCian ui.Color = 43
|
||||
ColorOrange ui.Color = 166
|
||||
ColorPurple ui.Color = 129
|
||||
ColorGreen ui.Color = 64
|
||||
ColorDarkGrey ui.Color = 240
|
||||
ColorWhite ui.Color = 7
|
||||
ColorBlack ui.Color = 0
|
||||
ColorClear ui.Color = -1
|
||||
)
|
||||
|
||||
type Palette struct {
|
||||
|
@ -30,9 +33,9 @@ type Palette struct {
|
|||
func GetPalette(theme Theme) Palette {
|
||||
switch theme {
|
||||
case ThemeDark:
|
||||
return Palette{Colors: []ui.Color{ColorOlive, ColorDeepSkyBlue, ColorDeepPink, ColorOlive, ColorDeepSkyBlue, ColorDeepPink}}
|
||||
return Palette{Colors: []ui.Color{ColorOlive, ColorDeepSkyBlue, ColorDeepPink, ColorWhite, ColorPurple, ColorCian, ColorOrange, ColorGreen}}
|
||||
case ThemeLight:
|
||||
return Palette{Colors: []ui.Color{ColorOlive, ColorDeepSkyBlue, ColorDeepPink, ColorOlive, ColorDeepSkyBlue, ColorDeepPink}}
|
||||
return Palette{Colors: []ui.Color{ColorOlive, ColorDeepSkyBlue, ColorDeepPink, ColorWhite, ColorPurple, ColorCian, ColorOrange, ColorGreen}}
|
||||
default:
|
||||
panic(fmt.Sprintf("Following theme is not supported: %v", theme))
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
)
|
||||
|
||||
type Item struct {
|
||||
Script string `yaml:"script"`
|
||||
Label string `yaml:"label"`
|
||||
Script string `yaml:"script"`
|
||||
Color *ui.Color `yaml:"color,omitempty"`
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue