Skip to content

Instantly share code, notes, and snippets.

@mikequentel
Created December 10, 2014 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikequentel/6bfc40638ca4a789f8e2 to your computer and use it in GitHub Desktop.
Save mikequentel/6bfc40638ca4a789f8e2 to your computer and use it in GitHub Desktop.
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;
@mikequentel
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment