Re: ANSI (color)codes ... (fwd)

From: Thomas Pedersen (classic@cloud9.net)
Date: 05/26/96


For those who requested ANSI codes, I had this laying around from previous
postings.

_/_/_/_/_/_/_/_/_/_/
_/ Classic@Cloud9.net
_/ uskgf89j@ibmmail.com 
_/ http://www.cloud9.net/~classic
_/_/_/_/_/_/_/_/_/_/

---------- Forwarded message ----------
Date: Wed, 24 Apr 1996 13:12:35 -0400 (EDT)
From: Barid Bel Medar <icarus@berkshire.net>
To: katzlbt@vuse.vanderbilt.edu
Cc: circle@pvv.unit.no
Subject: Re: ANSI (color)codes ...

On Tue, 23 Apr 1996, Katzlberger Thomas wrote:

> 
> Hi all ...
> 
> I tried to connect to the ANSI www site and
> forund out that they charge you MONEY for
> getting out their codes this really SUCKS !
> 
> Anyone know more of them ?

Yes.  Lookie:

Parameters used in ANSI escape sequences

Pn	Numeric parameter.  Specifies a decimal number.
Ps	Selective parameter.  Specifies a decimal number that you use
	to select a function.  You can specify more than one function by
	separating the parameters with semicolons.
PL	Line parameter.  Specifies a decimal number that represents one of
	the lines on your display or on another device.
Pc	Column parameter.  Specifies a decimal number that represents one
	of the columns on your screen or on another device.

ANSI escape sequences for cursor movement, graphics, and keyboard settings

In the following list of ANSI escape sequences, the abbreviation ASC 
represents the ASCII escape character 27 (1Bh), which appears at the 
beginning of each escape sequence.

ESC[PL;PcH
	Cursor Position  Moves the cursor to the specified position
	(coordinates).  If you do not specify a position, the cursor
	moves to the home position - the upper-left corner of the
	screen (line 0, column 0).  This escape sequence works the same
	way as the following Cursor Position escape sequence.

ESC[PL;Pcf
	Cursor Position  Works the same way as the preceding Cursor
	Position escape sequence.

ESC[PnA
	Cursor Up  Moves the cursor up by the specified number of lines
	without changing columns.  If the cursor is already on the top
	line, ANSI.SYS ignores this sequence.

ESC[PnB
	Cursor Down  Moves the cursor down by the specified number of lines
	without changing columns.  If the cursor is already on the bottom
	of the line, ANSI.SYS ignores this sequence.

ESC[PnC
	Cursor Forward  Moves the cursor forward by the specified number
	of columns without changing lines.  If the cursor is already in the
	rightmost column, ANSI.SYS ignores this sequence.

ESC[PnD
	Cursor Backward  Moves the cursor back by the specified number of
	columns without changing lines.  If the cursor is already in the
	leftmost column, ANSI.SYS ignores this sequence.

ESC[s
	Save Cursor Position  Saves the current cursor position.  You can
	move the cursor to the saved cursor position by using the
	Restore Cursor Position sequence.

ESC[u
	Restore Cursor Position  Returns the cursor to the position
	stored by the Save Cursor Position sequence.

ESC[2J
	Erase Display  Clears the screen and moves the cursor to the home
	position (line 0, column 0).

ESC[K
	Erase Line  Clears all characters from the cursor position to the
	end of the line (including the character at the cursor position).

ESC[Ps;...;Psm
	Set Graphics Mode  Calls the graphics functions specified by the
	following values.  These specified functions remain active until
	the next occurrence of this escape sequence.

	  Text attributes
		0	All attributes off
		1	Bold on
		4	Underscore (on monochrome display adapter only)
		5	Blink on
		7	Reverse video on
		8	Concealed on
	  Foreground colors
		30	Black
		31	Red
		32	Green
		33	Yellow
		34	Blue
		35	Magenta
		36	Cyan
		37	White
	  Background colors
		40	Black
		41	Red
		42	Green
		43	Yellow
		44	Blue
		45	Magenta
		46	Cyan
		47	White
	Parameters 30 through 47 meet the ISO 6429 standard.

ESC[=Psh
	Set Mode  Changes the screen width or type to the mode specified by
	one of the following values:

	0	40x25 monochrome (text)
	1	40x25 color (text)
	2	80x25 monochrome (text)
	3	80x25 color (text)
	4	320x200 4-color (graphics)
	5	320x200 monochrome (graphics)
	6	640x200 monochrome (graphics)
	7	Enables line wrapping
	13	320x200 color (graphics)
	14	640x200 color (16-color graphics)
	15	640x350 monochrome (2-color graphics)
	16	640x350 color (16-color graphics)
	17	640x480 monochrome (2-color graphics)
	18	640x480 color (16-color graphics)
	19	320x200 color (256-color graphics)

ESC[=Psl
	Reset Mode  Resets the mode by using the same values that Set Mode
	uses, except for 7, which disables line wrapping.  The last character
	in this escape sequence is a lowecase L.

ESC[code;string;...p
	Set Keyboard String  Redefines a keyboard key to a specified string.
	The parameters for this escape sequence are defined as follows:

  * Code is one or more of the values listed in the following table.  (Not
    duplicated here.)  These values represent keyboard keys and key
    combinations.  When using these values in a command, you must type the
    semicolons shown in this table in addition to the semicolons required
    by the escape sequence.  The codes in parentheses are not available on
    some keyboards.  ANSI.SYS might not interpret some of the codes in
    parantheses unless you specify the /x switch in the device command for
    ANSI.SYS

  * String is either the ASCII code for a single character or a string
    contained in quotation marks.  For example, both 65 and "A" can be
    used to represent an uppercase A.

    IMPORTANT  Some of the values in the following table are not valid for
	all computers.  Check your computer's documentation for values that
	are different.

(From the IBM DOS User's Guide and Reference for DOS 5.00, pp. 635-639)

> Do you have to reset the color before each change ?

No.  You can also omit the "text attributes" field from the string if 
it's the same.  For example, from bright white to bright blue, it's safe 
to skip that.  But from bright white to regular blue, you'd have to start 
with attribute zero.

> My client doesn't care it sets absolute colors
> depending on the code.

As it should.

------------------------------------------------------------------
Barid Bel Medar                               icarus@berkshire.net
Knights of the Cosmos            Shayol Ghul Resort and Health Spa
------------------------------------------------------------------
"I  am  returning  this otherwise good typing paper to you because
someone has printed gibberish all over it and  put  your  name  at
the top." - English Professor, Ohio University
------------------------------------------------------------------



This archive was generated by hypermail 2b30 : 12/18/00 PST