How to resolve the algorithm Terminal control/Coloured text step by step in the Ada programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Terminal control/Coloured text step by step in the Ada programming language

Table of Contents

Problem Statement

Display a word in various colours on the terminal. The system palette, or colours such as Red, Green, Blue, Magenta, Cyan, and Yellow can be used.

Optionally demonstrate:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Terminal control/Coloured text step by step in the Ada programming language

Source code in the ada programming language

with Ada.Text_Io;

with Ansi;

procedure Coloured  is
   use Ada.Text_Io;
   subtype Ansi_Colors is Ansi.Colors
     range Ansi.Black .. Ansi.Colors'Last;  -- Avoid default
begin
   for Fg_Color in Ansi_Colors loop
      Put ("Rosetta ");
      Put (Ansi.Foreground (Fg_Color));
      for Bg_Color in Ansi_Colors loop
         Put (Ansi.Background (Bg_Color));
         Put ("Code");
      end loop;
      Put (Ansi.Reset);
      New_Line;
   end loop;
end Coloured;


  

You may also check:How to resolve the algorithm Pangram checker step by step in the TXR programming language
You may also check:How to resolve the algorithm Quine step by step in the Prolog programming language
You may also check:How to resolve the algorithm Loops/Foreach step by step in the Elixir programming language
You may also check:How to resolve the algorithm Time a function step by step in the Maxima programming language
You may also check:How to resolve the algorithm Loops/Downward for step by step in the Factor programming language