Language:
Русский
English
{Getcolor.PAS}
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
{Sample code for the GetColor function.}
uses Graph;
var
Gd, Gm: Integer;
Color: Word;
Pal: PaletteType;
begin
Gd := Detect;
InitGraph(Gd, Gm, '');
if GraphResult <> grOk then
Halt(1);
Randomize;
GetPalette(Pal);
repeat
Color := Succ(GetColor);
if Color > Pal.Size - 1 then
Color := 0;
SetColor(Color);
LineTo(Random(GetMaxX), Random(GetMaxY));
until KeyPressed;
CloseGraph;
end.