RGB Mnemonic - Set Color

Syntax

'RGB'(color_string)
'RGB'(red_val,green_val,blue_val)

Description

The 'RGB' mnemonic directly sets the foreground and the background colors on a terminal.

Parameter

Description

color_string

Color number from the table below.

red_val,green_val,blue_val

Intensity of the red, green, and blue colors.

The color_string argument is a two-character string formatted in the same manner as that returned by the FIN() function and is mapped as follows (considering the two-character value as a 16 bit value):

Bit

Description

0..1

Foreground blue.

2..3

Foreground green.

4..5

Foreground red.

6..7

(Unused)

8..9

Background blue.

10..11

Background green.

12..13

Background red.

14..15

(Unused)

This mapping provides each color a value of 0..3, for a total number of color combinations of 64. On some systems, the foreground attribute may modify the color intensity for a total of 128 colors. The mnemonic simplifies restoring a set of saved colors by using the same bit mapping as that returned in the FIN() function. To provide the colors in a numeric form, each of the color values may be sent in the range 0..3.

NOTE: The following information is in reference to the command PRINT 'RGB'(hex_value).

To use the 'RGB'(color_string), notice that it is setup as a 16 BIT string. The first set of 8 bits controls the background RGB colors while the second set controls the RGB foreground (the "xx" are unused bits).

R G B R G B
xx| | | |xx| | | |

Enter binary values in the appropriate positions and then convert that entire binary value string to hex.

Next, PRINT 'RGB'($hexvalue$) within the VPRO/5 screen, which will change the screen color.

For example:

0000000000110011

for the binary string. This will make the screen colored black in the background and purple in the foreground.

The hex value of the above binary string is 0033. Enter the PRINT command as follows:

PRINT 'RGB'($0033$)

This command will change the foreground color to purple.

See Also

Mnemonics - Alphabetical Listing

Mnemonics - Group Listing