Simple Crt module examples for color

EAnder 0 Tallied Votes 267 Views Share

Using FPS IDE with FPC compiler on windows xp.

program PrettyConsole;
uses
    Crt;
var
    x : integer;
begin
    Window(1, 1, 10, 5);// start x, start y, width, height
    TextBackground(Blue);
    ClrScr;//now box screen is blue
    Readln;
    Window(1, 1, 80, 25);//default cmd screen size on my comp
    ClrScr;
    ReadLn;
    for x := 1 to 16 do
    begin
        Window(1, 1, 80, 25);//just me being carefull
        TextBackground(x);// might be more or less than 16, idk just found 16
                          //options on fpc documentation of crt module
        ClrScr;
        ReadLn;
    end;
    Window(1, 1, 80, 25);
    TextBackground(Black);
    TextColor(White);
    WriteLn('End of colorful fun :(');
    ReadLn;
    ReadLn;
end.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.