Hangfire.Console
Hangfire.Console copied to clipboard
Extending the colour support for the Console
Currently you have ConsoleTextColor which is used to set colours for the console however it is relatively limiting. For example, with the private constructor, it is impossible to define custom colours without reflection.
It would be great to use System.Drawing.Color as either a replacement to ConsoleTextColor or as a public constructor to that.
From a System.Drawing.Color instance, it is fairly easy to create the hexadecimal string that you are using internally too.
var hexString = $"#{color.R.ToString("X")}{color.G.ToString("X")}{color.B.ToString("X")}";
Like ConsoleTextColor, the System.Drawing.Color has a number of static/intellisense colours you can easily use but also allows creating custom colours by supplying an ARGB value.
In my opinion, while it would be a breaking change, I think it would be worth while replacing ConsoleTextColor outright rather than just adding a conversion class/method from System.Drawing.Color.
I believe System.Drawing.Color is not a part of netstandard before 2.0, and System.Drawing is known to cause a libgdiplus dependency mess on Unix platforms.
Yeah, System.Drawing.Color isn't part of pre-netstardard 2.0 though do you still want to target versions older than that?
If you're still hesitant, having a public constructor on ConsoleTextColor would then allow custom colours to be defined at least.