This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.
Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.
Project: Console Application Runner Classes
Unit: PJConsoleApp
Classes: TPJCustomConsoleApp, TPJConsoleApp
Applies to: ~>3.0
property ConsoleColors: TPJConsoleColors;
This property determines the foreground and background colours of a console window. It is of type TPJConsoleColors, which is a record with fields for both colours. Colours must be from the 16 basic system colours and are specified using the TPJConsoleColor enumeration.
Default values are ccWhite for the foreground colour and ccBlack for the background.
If a console application shares a console this property has no effect. See UseNewConsole for more information about shared consoles.
The individual fields of the property are read-only so the property must be set by first creating a TPJConsoleColors record containing the required foreground and background colours and then assigning the record to the property. For example:
var
Colors: TPJConsoleColors;
App: TPJConsoleApp;
begin
// assume App contains a valid TPJConsoleApp instance
Colors.Foreground := ccYellow;
Colors.Background := ccNavy;
App.ConsoleColors := Colors;
end;
The MakeConsoleColors routine has been provided to make this process easier. The following code has the same effect as the above:
var
App: TPJConsoleApp;
begin
// assume App contains a valid TPJConsoleApp instance
App.ConsoleColors := MakeConsoleColors(ccYellow, ccNavy);
end;
The property is public in TPJConsoleApp and protected in TPJCustomConsoleApp.