mirror of
https://github.com/miguelmota/cointop
synced 2024-11-10 13:10:26 +00:00
Simplify rank cell color handling
This commit is contained in:
parent
c79d601bbf
commit
b2e61bc8c9
@ -78,18 +78,20 @@ func (ct *Cointop) GetCoinsTable() *table.Table {
|
|||||||
rightMargin := 1
|
rightMargin := 1
|
||||||
switch header {
|
switch header {
|
||||||
case "rank":
|
case "rank":
|
||||||
star := ct.colorscheme.TableRow(" ")
|
star := " "
|
||||||
|
rankcolor := ct.colorscheme.TableRow
|
||||||
if coin.Favorite {
|
if coin.Favorite {
|
||||||
star = ct.colorscheme.TableRowFavorite("*")
|
star = "*"
|
||||||
|
rankcolor = ct.colorscheme.TableRowFavorite
|
||||||
}
|
}
|
||||||
rank := fmt.Sprintf("%s%v", star, ct.colorscheme.TableRow(fmt.Sprintf("%6v ", coin.Rank)))
|
rank := fmt.Sprintf("%s%6v ", star, coin.Rank)
|
||||||
ct.SetTableColumnWidth(header, 8)
|
ct.SetTableColumnWidth(header, 8)
|
||||||
ct.SetTableColumnAlignLeft(header, false)
|
ct.SetTableColumnAlignLeft(header, false)
|
||||||
rowCells = append(rowCells, &table.RowCell{
|
rowCells = append(rowCells, &table.RowCell{
|
||||||
LeftMargin: leftMargin,
|
LeftMargin: leftMargin,
|
||||||
RightMargin: rightMargin,
|
RightMargin: rightMargin,
|
||||||
LeftAlign: false,
|
LeftAlign: false,
|
||||||
Color: ct.colorscheme.Default,
|
Color: rankcolor,
|
||||||
Text: rank,
|
Text: rank,
|
||||||
})
|
})
|
||||||
case "name":
|
case "name":
|
||||||
|
Loading…
Reference in New Issue
Block a user