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
Represents the Escape key. Press Esc or substitute *E if you are in an application such as ED that uses the Esc key for its own purposes. When you press Esc, a reversed-color open bracket ([) appears in the console window.
[
Represents the open bracket key, displayed in Figure D-1. If you country's keyboard does not have an open bracket key, press Alt plus the key shown, regardless of what is shown on the keycap.
Figure D-1. Open Bracket Key Location
#
X
Represents an alphabetic key. Escape codes are case-sensitive. If an upper case letter is shown, press Shift and the key. If a lower case letter is shown, press the unshifted key.
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.
|