SGR—Select Graphic Rendition

This control function selects one or more character attributes at the same time.

Default: Clear all attributes.

Format

CSI
9/11
Ps
3/n
;
3/11
Ps
3/n
...
...
m
6/13

Parameters

Ps
is a number representing a certain visual attribute. You can use more than one Ps value to select different character attributes. Table 5–16 lists Ps values and the attributes they select.

Default: Ps = 0 (clears all attributes).

Table 5–16 Visual Character Attribute Values
Ps Attribute
0 All attributes off
1 Bold
4 Underline
5 Blinking
7 Negative image
8 Invisible image
10 The ASCII character set is the current 7-bit display character set (default)—SCO Console only.
11 Map Hex 00-7F of the PC character set codes to the current 7-bit display character set—SCO Console only.
12 Map Hex 80-FF of the current character set to the current 7-bit display character set—SCO Console only.
22 Bold off
24 Underline off
25 Blinking off
27 Negative image off
28 Invisible image off

Examples

When you select more than one attribute in an SGR sequence, then they are executed in order. For example, you can use the following sequence to display text that is bold, blinking, and underlined:

CSI 0 ; 1 ; 5 ; 4 m

The following sequence displays the negative image of text:

CSI 7 m

Notes on SGR

When a PC character set is selected . . . Displays . . .
Executing "CSI 10 m"

00-1F: control codes

20-7F: ASCII characters

80-FF: 8 bit PC characters

Executing "CSI 11 m"

00-1F: PC characters, except the following codes when XON/XOFF is enabled:

1B (ESC)

11 (DC1)

13 (DC3)

20-7F: ASCII characters (or PC 7 bit character)

80-FF: 8 bit PC characters

Executing "CSI 12 m"

00-1F: PC characters that are located in 80 - 9F in PC character set, except the following codes when XON/XOFF is enabled:

9B (ESC)

91 (DC1)

93 (DC3)

20-7F: PC characters located in A0-FF

80-FF: 8 bit PC characters.

When an ISO/ANSI character set is selected . . . Displays . . .
Executing "CSI 10 m"

00-1F: control codes

20-7F: ASCII characters

80-9F: control code

A0-FF: GR characters

Executing "CSI 12 m"

00-1F: control codes

20-7F: ISO/ANSI characters located in A0-FF

80-9F: control code

A0-FF: GR characters

Commands "CSI 10-12 m" affect only the Hex 00-7F portion of the display character set. The hex 80-FF region of the display character set is left intact.

The ASCII character set with control codes residing in Hex 00 to 1F region is the default 7-bit display character set. This is true regardless of the ISO/ANSI or PC character set. When in an ISO/ANSI character set, issuing "CSI 10 m" is equivalent to "designating and invoking ASCII to G0 and GL."

When "ESC 11 m" is executed, the display character set is loaded with codes in the Hex 00 to 7F region of a PC character set. PC characters whose code values are less than 1F can be displayed through this sequence except 1B (ESC) and 11(DC1), 13(DC3) when XON/XOFF is enabled. 1B is always executed as an ESC to allow the application to execute the command to go back to the default character set. Hex 11 and 13 can be displayed only when XON/XOFF is disabled. This command does not work when the ISO/ANSI character set is selected.

Command "ESC 12 m" toggles the high bit of the current 8-bit character set. All the characters in Hex 80-FF region can be displayed as 7-bit codes except 9B (ESC) and 91(DC1), 93(DC3) when XON/XOFF is enabled. After the command is executed, 1B is executed as an ESC. Hex 11 and 13 can be displayed only when XON/XOFF is disabled.

When in an ISO/ANSI character set, issuing "CSI 12 m" is equivalent to "designating and invoking current 8 bit char set to G2 and GL."