Hangfire.Console icon indicating copy to clipboard operation
Hangfire.Console copied to clipboard

Make ConsoleTextColor ctor public

Open vanbukin opened this issue 7 years ago • 1 comments

As I see, it just specifies an html color. I think it will be cool to allow specify any color if ctor become public.

vanbukin avatar May 23 '18 14:05 vanbukin

Here is a workaround that uses reflection to invoke the private constructor and create custom colors.

public static ConsoleTextColor GetColorViaReflection(string color)
{
    var ctor = typeof(ConsoleTextColor).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { typeof(string) }, null);
    return (ConsoleTextColor)ctor.Invoke(new[] { color });
}

wischi-chr avatar Apr 16 '21 23:04 wischi-chr