ConsoleColors example optimized

This commit is contained in:
Владислав Джавадов 2020-06-12 11:51:51 +03:00
parent c0078559bb
commit 777db5d972

View File

@ -3,76 +3,29 @@ program ConsoleColors;
uses
CRT;
const
ColorName: array[Black..White] of PKolibriChar = (
'Black', 'Blue', 'Green', 'Cyan', 'Red', 'Magenta', 'Brown', 'Light Gray',
'Dark Gray', 'Light Blue', 'Light Green', 'Light Cyan', 'Light Red', 'Light Magenta', 'Yellow', 'White'
);
var
Color: Byte;
begin
InitConsole('Console Colors');
TextBackground(Black);
WriteLn('Black');
TextBackground(Blue);
WriteLn('Blue');
TextBackground(Green);
WriteLn('Green');
TextBackground(Cyan);
WriteLn('Cyan');
TextBackground(Red);
WriteLn('Red');
TextBackground(Magenta);
WriteLn('Magenta');
TextBackground(Brown);
WriteLn('Brown');
TextBackground(LightGray);
WriteLn('LightGray');
TextBackground(DarkGray);
WriteLn('DarkGray');
TextBackground(LightBlue);
WriteLn('LightBlue');
TextBackground(LightGreen);
WriteLn('LightGreen');
TextBackground(LightCyan);
WriteLn('LightCyan');
TextBackground(LightRed);
WriteLn('LightRed');
TextBackground(LightMagenta);
WriteLn('LightMagenta');
TextBackground(Yellow);
WriteLn('Yellow');
TextBackground(White);
WriteLn('White');
for Color := Low(ColorName) to High(ColorName) do
begin
TextBackground(Color);
WriteLn(ColorName[Color]);
end;
NormVideo;
TextColor(Black);
WriteLn('Black');
TextColor(Blue);
WriteLn('Blue');
TextColor(Green);
WriteLn('Green');
TextColor(Cyan);
WriteLn('Cyan');
TextColor(Red);
WriteLn('Red');
TextColor(Magenta);
WriteLn('Magenta');
TextColor(Brown);
WriteLn('Brown');
TextColor(LightGray);
WriteLn('LightGray');
TextColor(DarkGray);
WriteLn('DarkGray');
TextColor(LightBlue);
WriteLn('LightBlue');
TextColor(LightGreen);
WriteLn('LightGreen');
TextColor(LightCyan);
WriteLn('LightCyan');
TextColor(LightRed);
WriteLn('LightRed');
TextColor(LightMagenta);
WriteLn('LightMagenta');
TextColor(Yellow);
WriteLn('Yellow');
TextColor(White);
WriteLn('White');
ReadKey;
for Color := Low(ColorName) to High(ColorName) do
begin
TextColor(Color);
WriteLn(ColorName[Color]);
end;
end.