Sign in to follow this  
Eldritch

ANSI colors for C# text

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this