From 8dd89487d0147923cd52c544f379355a8eafc8b5 Mon Sep 17 00:00:00 2001 From: Miguel Mota Date: Thu, 5 Apr 2018 02:30:54 -0700 Subject: [PATCH] white color table rows --- cointop/chart.go | 3 ++- cointop/marketbar.go | 2 +- cointop/table.go | 16 ++++++++-------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cointop/chart.go b/cointop/chart.go index fd5c9b8..e1e3b27 100644 --- a/cointop/chart.go +++ b/cointop/chart.go @@ -6,6 +6,7 @@ import ( "time" "github.com/gizak/termui" + "github.com/miguelmota/cointop/pkg/color" ) func (ct *Cointop) updateChart() error { @@ -20,7 +21,7 @@ func (ct *Cointop) updateChart() error { p := ct.chartpoints[i][j] s = fmt.Sprintf("%s%c", s, p.Ch) } - fmt.Fprintln(ct.chartview, s) + fmt.Fprintln(ct.chartview, color.White(s)) } return nil } diff --git a/cointop/marketbar.go b/cointop/marketbar.go index ff5cc8b..09886c4 100644 --- a/cointop/marketbar.go +++ b/cointop/marketbar.go @@ -17,7 +17,7 @@ func (ct *Cointop) updateMarketbar() error { timeframe := "7 Day" ct.Update(func() { 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 } diff --git a/cointop/table.go b/cointop/table.go index 7a62e94..823ad67 100644 --- a/cointop/table.go +++ b/cointop/table.go @@ -60,18 +60,18 @@ func (ct *Cointop) refreshTable() error { name = fmt.Sprintf("%s...", name[0:18]) } ct.table.AddRow( - fmt.Sprintf("%7v ", coin.Rank), - fmt.Sprintf("%.22s", name), - fmt.Sprintf("%.6s", coin.Symbol), + color.White(fmt.Sprintf("%7v ", coin.Rank)), + color.White(fmt.Sprintf("%.22s", name)), + color.White(fmt.Sprintf("%.6s", coin.Symbol)), colorprice(fmt.Sprintf("%12s", humanize.Commaf(coin.PriceUSD))), - fmt.Sprintf("%17s", humanize.Commaf(coin.MarketCapUSD)), - fmt.Sprintf("%15s", humanize.Commaf(coin.USD24HVolume)), + color.White(fmt.Sprintf("%17s", humanize.Commaf(coin.MarketCapUSD))), + color.White(fmt.Sprintf("%15s", humanize.Commaf(coin.USD24HVolume))), color1h(fmt.Sprintf("%8.2f%%", coin.PercentChange1H)), color24h(fmt.Sprintf("%8.2f%%", coin.PercentChange24H)), color7d(fmt.Sprintf("%8.2f%%", coin.PercentChange7D)), - fmt.Sprintf("%21s", humanize.Commaf(coin.TotalSupply)), - fmt.Sprintf("%18s", humanize.Commaf(coin.AvailableSupply)), - fmt.Sprintf("%18s", lastUpdated), + color.White(fmt.Sprintf("%21s", humanize.Commaf(coin.TotalSupply))), + color.White(fmt.Sprintf("%18s", humanize.Commaf(coin.AvailableSupply))), + color.White(fmt.Sprintf("%18s", lastUpdated)), // add %percent of cap ) }