[MUD-Dev] Re: Ansii color, needing some specs and or pointers.

Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
Mon Jul 27 23:21:08 CEST 1998


[Ben Greear:]

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

Yeah, I had requests for that too. So, I whined at one of the requesters
that I didn't know what he meant. So he sent me a spec and an example.
Rats! I never did do it though - it seemed silly to add something like
that to a multimedia system. Anyway, here is most of the email he
sent me (I'm sure he won't mind contributing to this list!)

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

I promised to send you the ANSI codes I used in my BBS, well I decided to=
 give all the possible ANSI codes, just for being complete.

Ok here they are:
--------------------------------------
M A X's BBS supports all the ANSI colour codes plus some cursor movement =
codes (Which I don't use and are generally very rare, so you don't need t=
o include these!, Mati). All ANSI codes begin with two characters "Escape=
" (^[) and "[", the following codes are optional numbers reperated by a s=
emi colon (;) and terminated with an "m" for a colour code, "A, B, C, or =
D" for a delta cursor movement or "H" for cursor position. The colour cod=
es can be as long as you like and are terminated with the "m" character.

eg:

<Esc>[n;n...m

<Esc> - the "Escape" (^[) character
[ - The "[" character
n - A number (see below)
; - Seperate numbers
m - Terminates the ANSI colour code

Where the "n" is a number representing a colour or attribute. Here are th=
e available colours:

30 - Black foreground
31 - Red foreground
32 - Green foreground
33 - Yellow foreground
34 - Blue foreground
35 - Magenta foreground
36 - Cyan foreground
37 - White foreground
40 - Black background
41 - Red background
42 - Green background
43 - Yellow background
44 - Blue background
45 - Magenta background
46 - Cyan background
47 - White background

Here are the available attributes:

0 - All attributes off (normal white on black)
1 - Bold on (high intensity)
3 - Italics on
4 - Underscore on
5 - Blink on (or italic if flashing text is turned off)
7 - Reverse video on (swaps foreground and background)

For a delta cursor movement the ANSI string is similar to the above, exce=
pt that you can only have one number and the termination character gives =
the direction of movement:

A - Cursor move up by n (north)
B - Cursor move down by n (south)
C - Cursor move right by n (east)
D - Cursor move left by n (west)

eg:

<Esc>[10A
The cursor will move up by ten lines

For cursor position the ANSI string is terminated by the "H" character:

eg:

<Esc>[n1;n2H
n1 - Row (line)
n2 - Column
If the number for both delta cursor movement and cursor position are zero=
 (0) or ommited, then they will default to one (1).

Changes from version 1.00 to version 1.10:

* The ANSI cursor position code now accepts just a row number and no colu=
mn number.

eg:

<Esc>[20H

Changes from version 1.16 to version 1.18:

* The ANSI codes "<Esc>[2J" and "<Esc>[2K" have been implemented. Some do=
or programs use these codes.

---------------------------------------------------
(source: MAX's BBS guide, by Anthony Barrett converted to AmigaGuide form=
at by Greg Fitch)

Sorry I had to include all these in the letter, Multiview just doesn't wa=
nt to copy a piece of text to a file, all had to be typed, I dropped the =
page layout, because on Email, it probably doesn't show up well.

I've also included a UUEncoded ANSI file, so you can test, hav a look at =
it.

Greeting from Holland! =


--BOUNDARY.6913.1425.4014360.2
Content-Type: application/octet-stream; name="Intro.text"
Content-Transfer-Encoding: x-uue
Content-Description:: : An ANSI example file.

begin 644 YAM.msg.2
M&ULP.S0P;1M;,DH;6T@*"B`@("`;6S$[,S5M5R!%($P at 0R!/($T at 12`@("!TM
M;SH*"B`@("`@("`@("`@("`@("`@("`@("`@("`@("`@(!M;,#LS-6U<7`H at 5
M("`@("`;6S$[,S-M+R]<("`@("]<("`@("`@&ULP.S,V;2\O7"`@("`@(!M;!
M,S5M+R]<("`@(!M;,S%M+R]<(!M;,S=M)R`@("`@("`@("`@("`@("`@&ULQK
M.S,U;5\*("`@("`;6S,S;2\O("]<("`O("]<("`@(!M;,#LS-FTO+R]<7"`@!
M("`;6S,U;2\O("]<("`;6S,Q;2\O("\@(!M;,S1M7U\@(!M;,3LS-6U\7"`@?
M+WP@?"`@?"!\(%P@("`@&ULS-&U?7R`@7U\@(%]?"B`@("`;6S,S;2\O("\@_
M(%PO("]<(%P@(!M;,#LS-FTO+R`O7"!<("`;6S,U;2\O("\@("`;6S,Q;2\O+
M("\@(!M;,S1M*%\@("`;6S$[,S5M?"!<+R!\('P@('P@?"`@?"`@&ULS-&U\P
M7U\I?%]?*2A?"B`@("`;6S,S;5Q<+R`@("!<+R`@7"\@(!M;,#LS-FU<7"\@?
M(%PO("`;6S,U;5Q<+R`@("`;6S,Q;5Q<+R`@(!M;,S1M7U\I("`;6S$[,S5M3
M?"`@("!\(%Q?7WP@?%]??"`@&ULS-&U\7U\I?%]?*5]?*0H@("`@("`@(!M;[
M,#LS,6W:Q,3$Q,3$Q,3$Q+\*("`@("`@(""S&ULQ.S,S;4)"4R!35$%44SH;*
M6S`[,S%MLPH@("`@("`@(,#$Q,3$Q,3$Q,3$V2`@("`@("`@("`@("`;6S,V4
M;4Y/1$4@(SHE4PH@("`@("`@("`;6S,S;25B+"`E=V)P<PH@("`@("`@("!,E
M87-T(&-A;&QE<CH@)4 at L("5)"B`@("`@("`@(%EO=2!A<F4 at 8V%L;&5R(",E6
M>"XN+ at H*("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@&ULS-FU,.
M87-T(&]N.B`;6S,U;25V"B`@("`@("`@("`@("`@("`@("`@("`@("`@("`@O
M("`@("`;6S,V;4%C8V5S<SH@&ULS-6TE;`H@("`@("`@("`@("`@("`@("`@>
M("`@("`@("`@("`;6S,V;51I;64@;&EM:70Z(!M;,S5M)6T*("`@("`@("`@;
M("`@("`@("`@("`@("`@("`@("`@(!M;,S9M1"]5(')A=&EO.B`;6S,U;25N+
M"B`@("`@("`@("`@("`@("`@("`@("`@&ULS-FU,87-T(&UE<W-A9V4@<F5AG
M9#H@&ULS-6TE;PH@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@G
M(!M;,S9M0V%L;',Z(!M;,S5M)7$*("`@("`@("`@("`@("`@("`@("`@("`@@
M("`@("`@("`;6S,V;4UE<W-A9V5S.B`;6S,U;25R"B`@("`@("`@("`@("`@*
M("`@("`@("`@("`@("`@("`@(!M;,S9M57!L;V%D<SH@&ULS-6TE<PH@("`@+
M("`@("`@("`@("`@("`@("`@("`@("`@("`@&ULS-FU$;W=N;&]A9',Z(!M;G
I,S5M)70@("`@("`@("`@("`@("`@("`@("`@("`@(!M;,6TE6AM;,&TZ.
``
end
size 1256

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

--
Chris Gray     cg at ami-cg.GraySage.Edmonton.AB.CA




More information about the mud-dev-archive mailing list