Previous Next Chapter

Using Escape Sequences

Escape sequences can control how the text appears in a console window, such as the texrt color, style (bold, italics, underline), and margins. AmigaDOS recognizes standard ANSI X3.64 sequences entered on the command line or embedded in strings. Escape sequences consist of one or more characters, sometimes with a numerical argument, prefaced by the escape character. Spaces are not normally used in the sequence of characters.

The escape sequence is shown using the following format:

Esc[#X

where:

Esc

[

Figure D-1. Open Bracket Key Location

#

X

The standard escape sequences for console windows are:

Sequence

Action

Escc

Clears the window and resets all modes to defaults.

Esc[0m

Resets graphics modes to defaults.

Esc[1m

Turns on text boldface.

Esc[3m

Turns on text italic.

Esc[4m

Turns on text underlining.

Esc[7m

Turns on reverse video text.

Esc[8m

Makes text match background color.

Esc[22m

Turns off boldface.

Esc[23m

Turns off italics.

Esc[24m

Turns off underlining.

Esc[27m

Turns off reverse video.

Esc[28m

Returns the text color to normal.

Esc[30m

Turns on text color0 (background, default grey).

Esc[31m

Turns on text color1 (shadow, default black).

Esc[32m

Turns on text color2 (shine, default white).

Esc[33m

Turns on text color3 (accent, default blue).

Esc[3#m

Turns on text color# (4-7).

Esc[39m

Turns on text default color (color1).

Esc[40m

Turns on text background color0 (default grey).

Esc[41m

Turns on text background color1 (default black).

Esc[42m

Turns on text background color2 (default white).

Esc[43,

Turns on text background color3 (default blue).

Esc[4#m

Turns on text background color# (4-7).

Esc[49m

Turns on default text background color (color0).

Esc[#u

Sets maximum length of lines in window to #.

Esc[#t

Sets maximum number of lines in window to #.

Esc[#x

Starts text # pixels from left edge of window.

Esc[#y

Starts text # pixels from top edge of window.

The escape sequence is executed when you press Return or when the string containing the sequence is printed.

Certain characters cannot normally be used in string arguments for AmgaDOS commands. Preceding these characters with an asterisk allows them to be used in string arguments for most commands, as follows.

*E

Represents the Escape key in a string.

*N

Forces a new line in the output.

*"

Allows a quotation mark character inside quotation marks.

**

Gives a single asterisk.

Top Previous Next Chapter