GET-COLOR

Function

Retrieves the current colors.

Syntax

GET-COLOR
[PRINT-TEXT-FOREGROUND=({color_name_var})]
[PRINT-TEXT-BACKGROUND=({color_name_var})]
[PRINT-PAGE-BACKGROUND=({color_name_var})]
[LINE-COLOR=({color_name_var})]
[FILL-COLOR=({color_name_var})]

Arguments

PRINT-TEXT-FOREGROUND

Color in which the text prints.

PRINT-TEXT-BACKGROUND

Background color behind the text.

PRINT-PAGE-BACKGROUND

Page background color.

LINE-COLOR

Line color used in DRAW and PRINT BOX.

FILL-COLOR

Fill color used in DRAW (TYPE=BOX) and PRINT BOX.

{color_name_var}

Text variable that receives the name of the specified color.

Description

GET-COLOR is allowed wherever PRINT or DRAW is allowed. It is used to retrieve certain attributes of PRINT and DRAW. If the requested attribute does not map to a defined color name, then 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 requested attribute.

begin-setup
 lighter_unknown = (93,122,129)
 set-color print-text-foreground=('lighter_unknown')
 get-color print-text-foreground=($print-foreground)
 print $print-foreground  (+2,7)
end-setup

Examples

begin-program
  declare-color-map
    light_blue = (193, 222, 229)
  end-declare
end-program
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
begin-program
  get-color line-color=($line-color)
  set-color line-color=('purple')
  draw (5,5) type='horz-line' width=10
  set-color line-color=($line-color)
end-program
begin-program
  get-color fill-color=($fill-color)
  set-color fill-color=('light grey')
  draw (5,5) type='box' width=10 height=10
  set-color fill-color=($fill-color)
end-program

See Also

DECLARE-COLOR-MAP, ALTER-COLOR-MAP, and SET-COLOR