white color table rows

pull/5/head
Miguel Mota 6 years ago
parent 76e28a6462
commit 8dd89487d0

@ -6,6 +6,7 @@ import (
"time" "time"
"github.com/gizak/termui" "github.com/gizak/termui"
"github.com/miguelmota/cointop/pkg/color"
) )
func (ct *Cointop) updateChart() error { func (ct *Cointop) updateChart() error {
@ -20,7 +21,7 @@ func (ct *Cointop) updateChart() error {
p := ct.chartpoints[i][j] p := ct.chartpoints[i][j]
s = fmt.Sprintf("%s%c", s, p.Ch) s = fmt.Sprintf("%s%c", s, p.Ch)
} }
fmt.Fprintln(ct.chartview, s) fmt.Fprintln(ct.chartview, color.White(s))
} }
return nil return nil
} }

@ -17,7 +17,7 @@ func (ct *Cointop) updateMarketbar() error {
timeframe := "7 Day" timeframe := "7 Day"
ct.Update(func() { ct.Update(func() {
ct.marketview.Clear() ct.marketview.Clear()
fmt.Fprintln(ct.marketview, pad.Right(fmt.Sprintf("%s Chart: %s • Total Market Cap: %s • 24H Volume: %s • BTC Dominance: %.2f%% • Active Currencies: %s • Active Markets: %s", color.Cyan("cointop"), timeframe, color.WhiteBold(humanize.Commaf(market.TotalMarketCapUSD)), humanize.Commaf(market.Total24HVolumeUSD), market.BitcoinPercentageOfMarketCap, humanize.Commaf(float64(market.ActiveCurrencies)), humanize.Commaf(float64(market.ActiveMarkets))), maxX, " ")) fmt.Fprintln(ct.marketview, color.White(pad.Right(fmt.Sprintf("%s Chart: %s • Total Market Cap: %s • 24H Volume: %s • BTC Dominance: %.2f%% • Active Currencies: %s • Active Markets: %s", color.Cyan("cointop"), timeframe, humanize.Commaf(market.TotalMarketCapUSD), humanize.Commaf(market.Total24HVolumeUSD), market.BitcoinPercentageOfMarketCap, humanize.Commaf(float64(market.ActiveCurrencies)), humanize.Commaf(float64(market.ActiveMarkets))), maxX, " ")))
}) })
return nil return nil
} }

@ -60,18 +60,18 @@ func (ct *Cointop) refreshTable() error {
name = fmt.Sprintf("%s...", name[0:18]) name = fmt.Sprintf("%s...", name[0:18])
} }
ct.table.AddRow( ct.table.AddRow(
fmt.Sprintf("%7v ", coin.Rank), color.White(fmt.Sprintf("%7v ", coin.Rank)),
fmt.Sprintf("%.22s", name), color.White(fmt.Sprintf("%.22s", name)),
fmt.Sprintf("%.6s", coin.Symbol), color.White(fmt.Sprintf("%.6s", coin.Symbol)),
colorprice(fmt.Sprintf("%12s", humanize.Commaf(coin.PriceUSD))), colorprice(fmt.Sprintf("%12s", humanize.Commaf(coin.PriceUSD))),
fmt.Sprintf("%17s", humanize.Commaf(coin.MarketCapUSD)), color.White(fmt.Sprintf("%17s", humanize.Commaf(coin.MarketCapUSD))),
fmt.Sprintf("%15s", humanize.Commaf(coin.USD24HVolume)), color.White(fmt.Sprintf("%15s", humanize.Commaf(coin.USD24HVolume))),
color1h(fmt.Sprintf("%8.2f%%", coin.PercentChange1H)), color1h(fmt.Sprintf("%8.2f%%", coin.PercentChange1H)),
color24h(fmt.Sprintf("%8.2f%%", coin.PercentChange24H)), color24h(fmt.Sprintf("%8.2f%%", coin.PercentChange24H)),
color7d(fmt.Sprintf("%8.2f%%", coin.PercentChange7D)), color7d(fmt.Sprintf("%8.2f%%", coin.PercentChange7D)),
fmt.Sprintf("%21s", humanize.Commaf(coin.TotalSupply)), color.White(fmt.Sprintf("%21s", humanize.Commaf(coin.TotalSupply))),
fmt.Sprintf("%18s", humanize.Commaf(coin.AvailableSupply)), color.White(fmt.Sprintf("%18s", humanize.Commaf(coin.AvailableSupply))),
fmt.Sprintf("%18s", lastUpdated), color.White(fmt.Sprintf("%18s", lastUpdated)),
// add %percent of cap // add %percent of cap
) )
} }

Loading…
Cancel
Save