Anciently VT100/Ansi-Descape Code You can still trigger several formats in console applications, including 24-bit colors, giving letters, spreading through underline, spreading and flash. The VT100/ANSI code is started by escape sign (ASCII sign 27, Hexadepimal: 0x1B).
Advertisement
Dr. Holder Schwichtenberg Technical Manager of the Network of experts www.it-visions.de, which supports many medium sizes and large companies through advice and training with 53 renowned experts as well as software development. Through his appearance in many national and international expert conferences as well as his appearance in more than 90 expert books and more than 1,500 expert articles, Holgar Schwichtanberg is one of the most famous experts for .NET and web techniques in Germany.

Before C# 13.0, you can use this Escape ASCII Sign 27 in .NET Console App Console.WriteLine()
Just express cumbersome \u001b
, \U0000001b
Or \x1b
, The latter is not recommended: “If you use Escapese \ X, indicate the signals following four hexadecimal digits and escape! If they are interpreted as part of Escapes. A Punjabi letter.
Usually, spent with VT100/ANSI-decape code before C# 13.0: Later:
Console.WriteLine("This is a regular text");
Console.WriteLine("\u001b(1mThis is a bold text\u001b(0m");
Console.WriteLine("\u001b(2mThis is a dimmed text\u001b(0m");
Console.WriteLine("\u001b(3mThis is an italic text\u001b(0m");
Console.WriteLine("\u001b(4mThis is an underlined text\u001b(0m");
Console.WriteLine("\u001b(5mThis is a blinking text\u001b(0m");
Console.WriteLine("\u001b(6mThis is a fast blinking text\u001b(0m");
Console.WriteLine("\u001b(7mThis is an inverted text\u001b(0m");
Console.WriteLine("\u001b(8mThis is a hidden text\u001b(0m");
Console.WriteLine("\u001b(9mThis is a crossed-out text\u001b(0m");
Console.WriteLine("\u001b(21mThis is a double-underlined text\u001b(0m");
Console.WriteLine("\u001b(38;2;255;0;0mThis is a red text\u001b(0m");
Console.WriteLine("\u001b(48;2;255;0;0mThis is a red background\u001b(0m");
Console.WriteLine("\u001b(38;2;0;0;255;48;2;255;255;0mThis is a blue text with a yellow background\u001b(0m");
Since c# 13.0 is now \e
Escape sign as a brief form for ASCII 27, so that the results of the string become very compact and clear:
Console.WriteLine("This is a regular text");
Console.WriteLine("\e(1mThis is a bold text\e(0m");
Console.WriteLine("\e(2mThis is a dimmed text\e(0m");
Console.WriteLine("\e(3mThis is an italic text\e(0m");
Console.WriteLine("\e(4mThis is an underlined text\e(0m");
Console.WriteLine("\e(5mThis is a blinking text\e(0m");
Console.WriteLine("\e(6mThis is a fast blinking text\e(0m");
Console.WriteLine("\e(7mThis is an inverted text\e(0m");
Console.WriteLine("\e(8mThis is a hidden text\e(0m");
Console.WriteLine("\e(9mThis is a crossed-out text\e(0m");
Console.WriteLine("\e(21mThis is a double-underlined text\e(0m");
Console.WriteLine("\e(38;2;255;0;0mThis is a red text\e(0m");
Console.WriteLine("\e(48;2;255;0;0mThis is a red background\e(0m");
Console.WriteLine("\e(38;2;0;0;255;48;2;255;255;0mThis is a blue text with a yellow background\e(0m");
The output of two previous listings looks the same.
(Image: Screenshot (Holgar Shavichenburg))
(RME)
