diff --git a/Examples/Console/ConsoleColors/ConsoleColors.dpr b/Examples/Console/ConsoleColors/ConsoleColors.dpr index f50bcc6..4b512d4 100644 --- a/Examples/Console/ConsoleColors/ConsoleColors.dpr +++ b/Examples/Console/ConsoleColors/ConsoleColors.dpr @@ -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.