[Tutor] ansi color coding

Michael Janssen Janssen@rz.uni-frankfurt.de
Thu Jan 2 14:30:02 2003


On Thu, 2 Jan 2003, Rusty Newton wrote:

> well im making a mud game or a multiuser online text game and i want
> to color the text, that i send to the users? does that explain
> anymore?

perhaps you search this:
print "\033[31mHello!\033[0m"  --> red

\033[ starts the format-cmd
30-37m chooses colours
0m sets back to standart

You can combine this with 1-7 for different styles:
print "\033[31;1mHello!\033[0m" --> bold red

bg-colors are in 40-47

for the fate of your users, please don't use 5 ;-)

Michael

PS: it's also working on (*nix-)console:
echo -e "\033[31mHello\033[0m"