[MUD-Dev] Re: Ansii color, needing some specs and or pointers.
Caliban Tiresias Darklock
caliban at darklock.com
Mon Jul 27 21:47:04 CEST 1998
On 09:18 PM 7/27/98 -0700, I personally witnessed Ben Greear jumping up to
say:
>
>The players keep yelping at me to provide some ansi color, but I'm
>clueless on the art, so I thought I'd see if any of you had any
>pointers? Surely I'm not the only one to be faced with this
>scourge!
An ANSI escape sequence consists of three basic parts. An escape (ASCII
character 27) and left bracket ([), a parameter, and a command. ANSI color
uses the command 'm'. So here's your ANSI color sequence: ESC[...m with the
parameter replacing the ellipsis and the actual escape character replacing
the ESC. The appropriate parameters are as follows...
0 - Normal intensity
1 - Bright intensity
(I forget what blink is. I think it's 7. Don't use it, in any case.)
Colors themselves are added to 30 for the foreground, 40 for the background:
0 - Black
1 - Red
2 - Green
3 - Yellow
4 - Blue
5 - Magenta
6 - Cyan
7 - White
So red is 31 for the foreground, 41 for the background. Blue is 34 or 44,
same thing. Multiple parameters may be separated by semicolons, so bright
red on a blue background would be ESC[0;31;44m -- and anything you DON'T
change stays the same. Once you set the background blue, it stays blue
until you change it again.
That's pretty much it. ANSI color is pretty easy. The full ANSI terminal
standard is a LOT more complex, but much of it is outdated and these days
you can't assume what you used to about the other end anymore (like 24
lines and 80 columns available or fixed width fonts).
More information about the mud-dev-archive
mailing list