douglasg14b / BetterConsoleTables

Faster, colorable, more configurable, and more robust console colors & tables for C# console applications
GNU Lesser General Public License v3.0
92 stars 16 forks source link

ForegroundColor seems to break the table. #28

Closed ViezeVingertjes closed 2 years ago

ViezeVingertjes commented 2 years ago

For some reason, when i try to use the ForegroundColor, it breaks the table. Anyone has had the same issue and possibly found a fix?

image

douglasg14b commented 2 years ago

Please post a reproducible example.


Likely a duplicate of #24

If so: Please use the formatting extensions for the column, or HasInnerFormatting(). You can find examples and explanations in the linked issue.

If not: I can't provide much help without example code that's setting up the table and values! 😃

ViezeVingertjes commented 2 years ago

Hi,

Thanks for the quick reply, it indeed seems to be a duplicate. The easiest way for me to just 'fix' it, was to just enable InnerFormatting for every header/column.

            var table = new Table(TableConfig.Unicode());
            table.From(statistics.ToArray());

            // Enable inner formatting for all columns.
            foreach (var header in table.Headers)
                header.RowsFormat.InnerFormatting = true;

            Console.Write(table.ToString());   

Of course accepting the performance hit, which isn't too bad in my case. (small tables)

douglasg14b commented 2 years ago

Thanks for checking back in!

I see how you're using it here and how it could be awkward 🤔

I haven't spent much time thinking about the experience of using the table.From() path, and assumed that path would be unformatted.

There are a few ways I could make this simpler, but I'd have to mull it over. I've made #29 in the meantime.