Skip to content

Commit

Permalink
IPInfo styling (#744)
Browse files Browse the repository at this point in the history
* WIP

Signed-off-by: Chris Cummer <[email protected]>

* Fix the colour scheme for IPInfo to match other modules

Now uses standard label and text colours.

Signed-off-by: Chris Cummer <[email protected]>
  • Loading branch information
senorprogrammer authored Nov 13, 2019
1 parent 1fda749 commit bf85d4b
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 15 deletions.
1 change: 1 addition & 0 deletions cfg/common_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func NewCommonSettingsFromModule(name, defaultTitle string, defaultFocusable boo
baseColors.RowTheme.EvenForeground = moduleConfig.UString("colors.rows.even", colorsConfig.UString("rows.even", defaultColorTheme.RowTheme.EvenForeground))
baseColors.RowTheme.OddForeground = moduleConfig.UString("colors.rows.odd", colorsConfig.UString("rows.odd", defaultColorTheme.RowTheme.OddForeground))

baseColors.TextTheme.Label = moduleConfig.UString("colors.label", colorsConfig.UString("label", defaultColorTheme.TextTheme.Label))
baseColors.TextTheme.Subheading = moduleConfig.UString("colors.subheading", colorsConfig.UString("subheading", defaultColorTheme.TextTheme.Subheading))
baseColors.TextTheme.Text = moduleConfig.UString("colors.text", colorsConfig.UString("text", defaultColorTheme.TextTheme.Text))
baseColors.TextTheme.Title = moduleConfig.UString("colors.title", colorsConfig.UString("title", defaultColorTheme.TextTheme.Title))
Expand Down
3 changes: 3 additions & 0 deletions cfg/default_color_theme.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ type RowTheme struct {

// TextTheme defines the default color scheme for text rendering
type TextTheme struct {
Label string
Subheading string
Text string
Title string
}

// WidgetTheme defines the default color scheme for the widget rect itself
type WidgetTheme struct {
Background string
}
Expand Down Expand Up @@ -74,6 +76,7 @@ func NewDefaultColorTheme() ColorTheme {
},

TextTheme: TextTheme{
Label: "lightblue",
Subheading: "red",
Text: "white",
Title: "green",
Expand Down
10 changes: 0 additions & 10 deletions modules/ipaddresses/ipinfo/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,14 @@ const (
defaultTitle = "IPInfo"
)

type colors struct {
name string
value string
}

type Settings struct {
colors
common *cfg.Common
}

func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {

settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
}

settings.colors.name = ymlConfig.UString("colors.name", "red")
settings.colors.value = ymlConfig.UString("colors.value", "white")

return &settings
}
4 changes: 2 additions & 2 deletions modules/ipaddresses/ipinfo/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ func (widget *Widget) setResult(info *ipinfo) {
resultBuffer := new(bytes.Buffer)

resultTemplate.Execute(resultBuffer, map[string]string{
"nameColor": widget.settings.colors.name,
"valueColor": widget.settings.colors.value,
"nameColor": widget.settings.common.Colors.Subheading,
"valueColor": widget.settings.common.Colors.Text,
"Ip": info.Ip,
"Hostname": info.Hostname,
"City": info.City,
Expand Down
1 change: 0 additions & 1 deletion modules/pagerduty/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type Settings struct {
}

func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {

settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),

Expand Down
1 change: 0 additions & 1 deletion modules/todo/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type Settings struct {
}

func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {

common := cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig)

settings := Settings{
Expand Down
1 change: 0 additions & 1 deletion modules/todoist/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type Settings struct {
}

func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {

settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),

Expand Down

0 comments on commit bf85d4b

Please sign in to comment.