• Advertisement
Sign in to follow this  

ANSI colors for C# text

This topic is 3914 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am building a text based game to which user can telnet. I am curious to know how I would go about making all ingame text strings support the use of ANSI color escape sequences (\[\033[0;30;40m for example). Right now, the compiler says that it is not a valid escape character. Is there any way to convert strings I use in C# to another format?

Share this post


Link to post
Share on other sites
Advertisement
You want to return the actual string with a slash in it so you need to escape the slash (i.e. wherever you want an actual slash in the string, you must put two, so the string "\[" becomes "\\[").

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement