GET-COLOR

Syntax

GET-COLOR [PRINT-TEXT-FOREGROUND=({color_name_var |{rgb})] [PRINT-TEXT-BACKGROUND=({color_name_var |{rgb})]

Description

Retrieves the current colors.

The GET-COLOR command is allowed wherever the PRINT command is allowed. If the requested color settings do not map to a defined name, the name is returned as RGBredgreenblue, where each component is a three-digit number—for example, RGB127133033. You can use this format wherever you use a color name. The color name 'none' is returned if no color is associated with the specified area.

Parameters

Parameter Description

PRINT-TEXT-

FOREGROUND

Defines the color in which the text prints.

PRINT-TEXT-

BACKGROUND

Defines the color to print as a background behind the text.

{color_name_var}

A color_name is composed of alphanumeric characters (A–Z, 0–9), the underscore (_) character, and the hyphen (-) character. The name must start with an alphabetical (A–Z) character and is not case-sensitive. The name 'none' is reserved and cannot be assigned a value. A name in the format (RGBredgreenblue) cannot be assigned a value. The name 'default' is reserved and can be assigned a value. 'Default' is used during execution when a referenced color is not defined in the runtime environment.

{rgb}

red_lit | _var | _col, green_lit | _var | _col, blue_lit | _var | _col where each component is a value in the range of 000 to 255. In the BEGIN-SETUP section, only literal values are allowed.

The default colors implicitly installed with SQR include:

black=(0,0,0)

white=(255,255,255)

gray=(128,128,128)

silver=(192,192,192)

red=(255,0,0)

green=(0,255,0)

blue=(0,0,255)

yellow=(255,255,0)

purple=(128,0,128)

olive=(128,128,0)

navy=(0,0,128)

aqua=(0,255,255)

lime=(0,128,0)

maroon=(128,0,0)

teal=(0,128,128)

fuchsia=(255,0,255)

Example

The following example illustrates the GET-COLOR command:

begin-setup
   declare-color-map
   light_blue = (193, 222, 229)
   end-declare
end-setup

begin-program
   alter-color-map name = 'light_blue' value = (193, 233, 230)

   print 'Yellow Submarine' ()
      foreground = ('yellow')
      background = ('light_blue')

   get-color print-text-foreground = ($print-foreground)  
   set-color print-text-foreground = ('purple')
   print 'Barney' (+1,1)
   set-color print-text-foreground = ($print-foreground)
end-program

See DECLARE-COLOR-MAP, ALTER-COLOR-MAP, SET-COLOR