So I'm trying to find a simple code that makes my code get printed in bold. When I searched the internet all of them were so complicated that it wasn't even worth it. Is there any easier way to make a string or just a Console.WriteLine(" "); bold?
Console.Write("Type in the number of people to create: ");
int time = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("\nGenerating " + time + " people please stand by...");
System.Threading.Thread.Sleep(3000);
Console.Clear();
You can use the ANSII escape codes, as long as your console supports it.
You can do basics like, color text, background and bold,underline and reverse colors. for example in c#
Console.WriteLine("\x1b[1mTEST\x1b[0m");
will print it in bold \x1b[0m
one at the end is to reset the formatting, many formatting options are made by changing the number after the bracket.
look into these links, I have used it with C and Python in bash, but I'm not sure about C# at the moment.
https://www.jerriepelser.com/blog/using-ansi-color-codes-in-net-console-apps/
ANSI-Coloring Console Output with .NET
This link has all the codes for ANSII escape codes, I have used it in C, so It may need some modifications.
http://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With