1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

IPInfo styling (#744)

* WIP

Signed-off-by: Chris Cummer <chriscummer@me.com>

* Fix the colour scheme for IPInfo to match other modules

Now uses standard label and text colours.

Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
Chris Cummer 2019-11-12 20:10:26 -08:00 committed by GitHub
parent 1fda7492e4
commit bf85d4b144
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 6 additions and 15 deletions

View File

@ -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.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.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.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.Text = moduleConfig.UString("colors.text", colorsConfig.UString("text", defaultColorTheme.TextTheme.Text))
baseColors.TextTheme.Title = moduleConfig.UString("colors.title", colorsConfig.UString("title", defaultColorTheme.TextTheme.Title)) baseColors.TextTheme.Title = moduleConfig.UString("colors.title", colorsConfig.UString("title", defaultColorTheme.TextTheme.Title))

View File

@ -31,11 +31,13 @@ type RowTheme struct {
// TextTheme defines the default color scheme for text rendering // TextTheme defines the default color scheme for text rendering
type TextTheme struct { type TextTheme struct {
Label string
Subheading string Subheading string
Text string Text string
Title string Title string
} }
// WidgetTheme defines the default color scheme for the widget rect itself
type WidgetTheme struct { type WidgetTheme struct {
Background string Background string
} }
@ -74,6 +76,7 @@ func NewDefaultColorTheme() ColorTheme {
}, },
TextTheme: TextTheme{ TextTheme: TextTheme{
Label: "lightblue",
Subheading: "red", Subheading: "red",
Text: "white", Text: "white",
Title: "green", Title: "green",

View File

@ -10,24 +10,14 @@ const (
defaultTitle = "IPInfo" defaultTitle = "IPInfo"
) )
type colors struct {
name string
value string
}
type Settings struct { type Settings struct {
colors
common *cfg.Common common *cfg.Common
} }
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings { func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{ settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig), 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 return &settings
} }

View File

@ -87,8 +87,8 @@ func (widget *Widget) setResult(info *ipinfo) {
resultBuffer := new(bytes.Buffer) resultBuffer := new(bytes.Buffer)
resultTemplate.Execute(resultBuffer, map[string]string{ resultTemplate.Execute(resultBuffer, map[string]string{
"nameColor": widget.settings.colors.name, "nameColor": widget.settings.common.Colors.Subheading,
"valueColor": widget.settings.colors.value, "valueColor": widget.settings.common.Colors.Text,
"Ip": info.Ip, "Ip": info.Ip,
"Hostname": info.Hostname, "Hostname": info.Hostname,
"City": info.City, "City": info.City,

View File

@ -23,7 +23,6 @@ type Settings struct {
} }
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings { func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{ settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig), common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),

View File

@ -19,7 +19,6 @@ type Settings struct {
} }
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings { func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
common := cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig) common := cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig)
settings := Settings{ settings := Settings{

View File

@ -20,7 +20,6 @@ type Settings struct {
} }
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings { func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{ settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig), common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),