Contents | Prev | Next

7.4.57 The textbackground procedure

Description

The textbackground procedure sets the current text background color.

Calling this procedure does not immediately change the background color of the screen. The background colors of characters already on the screen are not changed, what this procedure does is to change the background color of characters written to the screen after the procedure is called. The following table shows the values used to specify various background colors.

value  color
  0    Black
  1    Blue
  2    Green
  3    Cyan
  4    Red
  5    Magenta
  6    Brown
  7    White

Parameter

The textbackground procedure's only parameter is an expression of integral type that specifies the new text background color.

Example

//**************************************************************
// This program uses the built-in procedure "textbackground" to
// change the background color. If you are using Windows try
// running this program and see what happens.
//**************************************************************
program bc(output);
(*$W44-*) //Suppress warning message about "constant defined but no used",
          //since we already know we are not using all of the constants.
const
   black = 0;
   blue = 1;
   green = 2;
   cyan = 3;
   red = 4;
   magenta = 5;
   brown = 6;
   white = 7;
   blinking = 8;
(*$W44+*)
begin
   write('Normal background ');
   textbackground(blue + blinking);
   write('Blinking blue background ');
   textbackground(black);
   writeln('Normal background ');
end.

Portability

Operating Systems: Windows only
Standard Pascal: No

Contents | Prev | Next