简体   繁体   中英

ANSI colors and writing directly to console output C#

how can I use more colors in console while using WriteConsoleOutput and WriteConsoleOutputAttribute?
I found you can write ANSI colors using Console.Write, but how can I do this using those two methods?

In C# is works like in C. I use it in C# some minutes ago and it works fine. Here is the Color table: https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit

C# Example:

    Console.Write("\x1B[38;5;{0}m", runtime.Register[2]);

C Example:

    printf ( "\x1B[38;5;%dm", color );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM