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

Version 2 default table text color #16

Closed TWry closed 4 years ago

TWry commented 4 years ago

Is there a way to change the default text color in version 2? After transitioning from v1 to v2, all table text was colored gray. I know that you can change it by using ColumnBuilder but it seems overly verbose to have to change it for each and every column for both the column header and rows. # #

douglasg14b commented 4 years ago

Thanks for trying v2!

Looks like I had set the default to Color.LightGrey (#D3D3D3) instead of Color.White for one reason or another.

Right now this is a constant in the BetterConsole.Core library and can't be changed by the user, though it could be configured through a static property.

douglasg14b commented 4 years ago

The API for this would be:

BetterConsole.Core.Constants.UserDefinedDefaultForegroundColor = Color.Magenta;

This will give preference to your defined color over the constant.

Note that this only affects text, table borders/dividers are not colored at this time.

douglasg14b commented 4 years ago

This will be available in BetterConsole.Core v1.1.0 which will be available once Nuget indexes it.

https://www.nuget.org/packages/BetterConsole.Core/1.1.0

This changes the default color to White, as well as adds the ability to override that default.

TWry commented 4 years ago

Excellent, many thanks for accommodating my request! Will try this as soon as Nuget found the new version.

TWry commented 4 years ago

It seems something is wrong. I'm getting the following exception now:

Unhandled exception. System.MissingFieldException: Field not found: 'BetterConsole.Core.Constants.DefaultForegroundColor'. at BetterConsole.Colors.Format..ctor() at BetterConsoleTables.Models.CellFormat..ctor() at BetterConsoleTables.Models.CellFormat.Default() at BetterConsoleTables.Models.Column..ctor(String columnTitle, ICellFormat headerFormat, ICellFormat rowsFormat) at BetterConsoleTables.Builders.ColumnBuilder..ctor(String columnTitle) at ConsoleApp1.Program.PrintTableSchemas(OracleConnection con) in /Users/twry/RiderProjects/ConsoleApp1/ConsoleApp1/Program.cs:line 54 at ConsoleApp1.Program.Main(String[] args) in /Users/twry/RiderProjects/ConsoleApp1/ConsoleApp1/Program.cs:line 21

douglasg14b commented 4 years ago

Well that's unexpected, do you have a code snippet that causes this?

douglasg14b commented 4 years ago

Oh, I see the issue. Since I changed this from a field to a property the build BetterConsole.Colors DLL is referencing a field still, so I need to push a rebuilt BetterConsole.Colors version

douglasg14b commented 4 years ago

BetterConsole.Colors v1.0.1 has been published as well as BetterConsoleTables v2.0.1-beta1, please upgrade these packages when able.

TWry commented 4 years ago

Done, all working now, thanks!

douglasg14b commented 4 years ago

Closing as this appears to be resolved.