tomakita / Colorful.Console

Style your .NET console output!

Repository from Github https://github.comtomakita/Colorful.ConsoleRepository from Github https://github.comtomakita/Colorful.Console

Feature Request: WriteLineFormatted with interpolated strings

NotoriousRebel opened this issue · comments

commented

Currently I have to do

public static Formatter[] cProps = {
            new Formatter("[>]", Color.Yellow),
            new Formatter("|->", Color.LightGreen),
            new Formatter("[+]", Color.Red),
        };
 Console.WriteLineFormatted("{0} " + myString + "  is awesome", Color.Red, cProps);

I would love to do this as this is taking advantage of interpolated strings, is cleaner, and easier to write

public static Formatter[] cProps = {
            new Formatter("[>]", Color.Yellow),
            new Formatter("|->", Color.LightGreen),
            new Formatter("[+]", Color.Red),
        };
 Console.WriteLineFormatted($"{0} {myString} is awesome", Color.Red, cProps);

Not sure how hard that would be though 🤔

Thanks to @ollelogdahl's PR (#77 ), this is now possible!

Available in version 1.2.11: https://www.nuget.org/packages/Colorful.Console/1.2.11