Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
How to Create a Text File List of RGB Values in Ada
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
procedure rgb is
subtype Rgb_Int is integer range 0..255;
fp: File_Type;
r: Rgb_Int := 255;
g: Rgb_Int := 255;
b: Rgb_Int := 255;
begin
create(File=>fp, Mode=>Out_File, Name=>"true_colour_ada.txt");
for r in reverse 0..255 loop
for g in reverse 0..255 loop
for r in reverse 0..255 loop
Put_Line(fp, Trim(Rgb_Int'Image(r), Left) & "," & Trim(Rgb_Int'Image(g), Left) & "," & Trim(Rgb_Int'Image(b), Left));
end loop;
end loop;
end loop;
close(fp);
end rgb;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment