From d6b0039c90ef6d7cba6be12a41c48ca264660378 Mon Sep 17 00:00:00 2001 From: joce Date: Mon, 21 Feb 2022 23:14:53 -0500 Subject: [PATCH] `Profile.TickerColors` => `Profile.Colors` --- markup.go | 6 +++--- profile.go | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/markup.go b/markup.go index 461cdb3..465e40c 100644 --- a/markup.go +++ b/markup.go @@ -55,9 +55,9 @@ func NewMarkup(profile *Profile) *Markup { markup.tags[`r`] = termbox.AttrReverse // Semantic markups - markup.tags[`gain`] = markup.tags[profile.TickerColors.Gain] - markup.tags[`loss`] = markup.tags[profile.TickerColors.Loss] - markup.tags[`tag`] = markup.tags[profile.TickerColors.Tag] + markup.tags[`gain`] = markup.tags[profile.Colors.Gain] + markup.tags[`loss`] = markup.tags[profile.Colors.Loss] + markup.tags[`tag`] = markup.tags[profile.Colors.Tag] markup.regex = markup.supportedTags() // Once we have the hash we could build the regex. diff --git a/profile.go b/profile.go index c876492..7dbd62c 100644 --- a/profile.go +++ b/profile.go @@ -28,7 +28,7 @@ type Profile struct { Ascending bool // True when sort order is ascending. Grouped bool // True when stocks are grouped by advancing/declining. Filter string // Filter in human form - TickerColors struct { // Ticker colors + Colors struct { // User defined colors Gain string Loss string Tag string @@ -67,26 +67,26 @@ func NewProfile(filename string) *Profile { profile.SortColumn = 0 // Stock quotes are sorted by ticker name. profile.Ascending = true // A to Z. profile.Filter = "" - profile.TickerColors.Gain = defaultGainColor - profile.TickerColors.Loss = defaultLossColor - profile.TickerColors.Tag = defaultTagColor + profile.Colors.Gain = defaultGainColor + profile.Colors.Loss = defaultLossColor + profile.Colors.Tag = defaultTagColor profile.Save() } else { json.Unmarshal(data, profile) - profile.TickerColors.Gain = strings.ToLower(profile.TickerColors.Gain) - if !IsSupportedColor(profile.TickerColors.Gain) { - profile.TickerColors.Gain = defaultGainColor + profile.Colors.Gain = strings.ToLower(profile.Colors.Gain) + if !IsSupportedColor(profile.Colors.Gain) { + profile.Colors.Gain = defaultGainColor } - profile.TickerColors.Loss = strings.ToLower(profile.TickerColors.Loss) - if !IsSupportedColor(profile.TickerColors.Loss) { - profile.TickerColors.Loss = defaultLossColor + profile.Colors.Loss = strings.ToLower(profile.Colors.Loss) + if !IsSupportedColor(profile.Colors.Loss) { + profile.Colors.Loss = defaultLossColor } - profile.TickerColors.Tag = strings.ToLower(profile.TickerColors.Tag) - if !IsSupportedColor(profile.TickerColors.Tag) { - profile.TickerColors.Tag = defaultTagColor + profile.Colors.Tag = strings.ToLower(profile.Colors.Tag) + if !IsSupportedColor(profile.Colors.Tag) { + profile.Colors.Tag = defaultTagColor } profile.SetFilter(profile.Filter)