gizak / termui

Golang terminal dashboard
MIT License
13.14k stars 787 forks source link

Make BarChart cell character configurable. #95

Closed leighmcculloch closed 8 years ago

leighmcculloch commented 8 years ago

What

Make BarChart cell character configurable.

Why

So that it can be set to a non-space character, which can be useful in some situations. For example, it allows the barcharts to be used as ASCII art and copy-pastable.

Example

https://github.com/leighmcculloch/keywords

leighmcculloch commented 8 years ago

@gizak How would you feel about merging this? Are there any changes that would be needed to do so?

gizak commented 8 years ago

Hi @leighmcculloch sorry for the delay. It looks great to me, and I will test/merge it soon.

leighmcculloch commented 8 years ago

gizak commented 8 years ago

Hi @leighmcculloch , I tested against _example/dashboard.go and it looked like this (with CellChar = 'x'):

screen shot 2016-08-13 at 21 48 40

It's a bit messy, so I guess that's not intended.

If I understand correct, CellChar should serve as a background pattern, and to do so we have to change the CellChar's colour to the BarColor and make the CellChar's background colour go away.

leighmcculloch commented 8 years ago

@gizak Thanks for merging 😄 . That screenshot looks correct. Indeed the developer could also configure the BarColor to black so that there was no bar color visible. We could introduce a None color for setting no color. Either way it's all configurable for the developer using the BarChart.