khalidabuhakmeh / ConsoleTables

Print out a nicely formatted table in a console application C#
MIT License
944 stars 157 forks source link

Add background color support #21

Closed sepharg closed 3 years ago

sepharg commented 7 years ago

It´d be great if you could add a background color to each row based on some property of the item, that could be defined by a delegate. For example, you add an overload that accepts a function like this

ConsoleTable.From<Item>(myResults, (item) => { item.Value > 50 ? RowBackground.Red : RowBackground.Green }).Write();

In this case rows that contain items with value bigger than 50 will be printed out with a red background, the rest with a green one.

sepharg commented 7 years ago

any thoughts on this @khalidabuhakmeh ? if you're not able to add this maybe i can collaborate and add it myself if that's ok for you?

kiran94 commented 6 years ago

I would also be interested in something like this. It would also be good to have foreground colour support.

khalidabuhakmeh commented 6 years ago

Feel free to submit a PR. Most changes are welcome and I'll help where I can 😁

CerebralMischief commented 3 years ago

Feel free to submit a PR. Most changes are welcome, and I'll help where I can 😁

Unfortunately, people are happy to use code other people wrote, but contributing to it is asking far too much. 😁

khalidabuhakmeh commented 3 years ago

It's cool, I know folks are busy.

I recommend folks check out https://github.com/spectresystems/spectre.console.

ConsoleTables was a hobby project. Patrik has definitely done a great job and I've contributed a few ideas there. .NET OSS for the win. :)