TextBackground

From Delphi Pascal wiki
Jump to navigation Jump to search

Selects the background color.


Declaration
procedure TextBackground(Color: Byte);
Target
Real, Protected
Remarks
Color is an integer expression in the range 0..7, corresponding to one of the first eight text color constants. There is a byte variable in Crt TextAttr that is used to hold the current video attribute. TextBackground sets bits 4-6 of TextAttr to Color.
The background of all characters subsequently written will be in the specified color.


See Also
HighVideo
LowVideo
NormVideo
TextColor


Sample Code
{NormVid.PAS}
{ Example for NormVideo, TextBackGround, and TextColor }

uses Crt;
begin
  { Green characters on black}
  TextColor(Green);
  TextBackground(Black);
  WriteLn('Hey there!');
  { Blinking light-red characters on gray }
  TextColor(LightRed+Blink);
  TextBackground(LightGray);
  WriteLn('Hi there!');
  { Yellow characters on blue }
  TextColor(14); { Yellow = 14 }
  TextBackground(Blue);
  WriteLn('Ho there!');
  NormVideo; { Original attribute }
  WriteLn('Back to normal...');
end.