|
|
@ -28,7 +28,7 @@ type Profile struct { |
|
|
|
Ascending bool // True when sort order is ascending.
|
|
|
|
Ascending bool // True when sort order is ascending.
|
|
|
|
Grouped bool // True when stocks are grouped by advancing/declining.
|
|
|
|
Grouped bool // True when stocks are grouped by advancing/declining.
|
|
|
|
Filter string // Filter in human form
|
|
|
|
Filter string // Filter in human form
|
|
|
|
TickerColors struct { // Ticker colors
|
|
|
|
Colors struct { // User defined colors
|
|
|
|
Gain string |
|
|
|
Gain string |
|
|
|
Loss string |
|
|
|
Loss string |
|
|
|
Tag string |
|
|
|
Tag string |
|
|
@ -67,26 +67,26 @@ func NewProfile(filename string) *Profile { |
|
|
|
profile.SortColumn = 0 // Stock quotes are sorted by ticker name.
|
|
|
|
profile.SortColumn = 0 // Stock quotes are sorted by ticker name.
|
|
|
|
profile.Ascending = true // A to Z.
|
|
|
|
profile.Ascending = true // A to Z.
|
|
|
|
profile.Filter = "" |
|
|
|
profile.Filter = "" |
|
|
|
profile.TickerColors.Gain = defaultGainColor |
|
|
|
profile.Colors.Gain = defaultGainColor |
|
|
|
profile.TickerColors.Loss = defaultLossColor |
|
|
|
profile.Colors.Loss = defaultLossColor |
|
|
|
profile.TickerColors.Tag = defaultTagColor |
|
|
|
profile.Colors.Tag = defaultTagColor |
|
|
|
profile.Save() |
|
|
|
profile.Save() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
json.Unmarshal(data, profile) |
|
|
|
json.Unmarshal(data, profile) |
|
|
|
|
|
|
|
|
|
|
|
profile.TickerColors.Gain = strings.ToLower(profile.TickerColors.Gain) |
|
|
|
profile.Colors.Gain = strings.ToLower(profile.Colors.Gain) |
|
|
|
if !IsSupportedColor(profile.TickerColors.Gain) { |
|
|
|
if !IsSupportedColor(profile.Colors.Gain) { |
|
|
|
profile.TickerColors.Gain = defaultGainColor |
|
|
|
profile.Colors.Gain = defaultGainColor |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
profile.TickerColors.Loss = strings.ToLower(profile.TickerColors.Loss) |
|
|
|
profile.Colors.Loss = strings.ToLower(profile.Colors.Loss) |
|
|
|
if !IsSupportedColor(profile.TickerColors.Loss) { |
|
|
|
if !IsSupportedColor(profile.Colors.Loss) { |
|
|
|
profile.TickerColors.Loss = defaultLossColor |
|
|
|
profile.Colors.Loss = defaultLossColor |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
profile.TickerColors.Tag = strings.ToLower(profile.TickerColors.Tag) |
|
|
|
profile.Colors.Tag = strings.ToLower(profile.Colors.Tag) |
|
|
|
if !IsSupportedColor(profile.TickerColors.Tag) { |
|
|
|
if !IsSupportedColor(profile.Colors.Tag) { |
|
|
|
profile.TickerColors.Tag = defaultTagColor |
|
|
|
profile.Colors.Tag = defaultTagColor |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
profile.SetFilter(profile.Filter) |
|
|
|
profile.SetFilter(profile.Filter) |
|
|
|