Open natrajgs opened 4 years ago
There are two kinds of lines at play here.
_____ _ _
| __|_|___ ___| |___
| __| | . | . | | -_|
|__| |_|_ |_ |_|___|
|___|___|
In that example, you could say the first line is the word "Figgle". But actually, from the perspective of the console, that text is 5 different lines of text:
Line 1: _____ _ _
Line 2: | __|_|___ ___| |___
Line 3: | __| | . | . | | -_|
Line 4: |__| |_|_ |_ |_|___|
Line 5: |___|___|
The Render
method is returning a multi-line string (i.e. containing line endings). When you write it to the console, the cursor ends up at the bottom right corner of the text. If you try to write more text, it'll probably appear slightly broken and underneath the first thing you wrote.
Assuming I understand you correctly, you're asking for multi-colour printing support. Does that sound right? If so, then this is a feature request as it's not something that's currently supported.
Yes, that is what exactly I was looking for - please change to a feature request.
Try like this.
var text = FiggleFonts.Standard.Render(message);
var result = Regex.Split(text, "\r\n|\r|\n");
var currentColor = Console.ForegroundColor;
var colors = new Queue<ConsoleColor>();
colors.Enqueue(ConsoleColor.Red);
colors.Enqueue(ConsoleColor.Green);
colors.Enqueue(ConsoleColor.Blue);
foreach (var line in result)
{
var color = colors.Dequeue();
Console.ForegroundColor = color;
Console.WriteLine(line);
colors.Enqueue(color);
}
Console.ForegroundColor = currentColor;
I interpret the original request here as allowing individual characters to be printed in different colours. In the "Hello World!" example, the 'H' might be a different colour to the 'e'.
I suspect something like this would need to use control characters in the output to work correctly.
I am trying to print some characters in one color and rest of then in another color - but cannot
Console.Write
is acting likeConsole.WriteLine
i.e. adding an line break.