It's 3 iterations of colors. I recreated the exact same colors as given in the question with rather simple code.
The first rows of 16 colors are a binary count to 8 (repeated twice with exactly the same colors). The first bit represents red, the second bit green and the third bit blue. I know the binary numbers are backwards, but this way it fits into the RGB schema.
| count | 000 | 100 | 010 | 110 | 001 | 101 | 011 | 111
| R | 85 | 255 | 85 | 255 | 85 | 255 | 85 | 255
| G | 85 | 85 | 255 | 255 | 85 | 85 | 255 | 255
| B | 85 | 85 | 85 | 85 | 255 | 255 | 255 | 255
Then follows an iteration through finer RGB values. There are 6 steps for each color value:
steps: 0 | 95 | 135 | 175 | 215 | 255
The iterations are nested like this:
loop through 6 steps of red
{
loop through 6 steps of green
{
loop through 6 steps of blue
{
print number in color(red, green, blue);
}
}
}
That's why the color runs smoothly through 36 similar tones and then suddenly shifts back to red. The innermost loop (blue value) is executed without interuption, when it finishes, the middle loop (green value) executes one single step, before the innermost loop executes again. The red value doesn't change for 36 steps, until the middle loop finishes and the outermost loop (red value) executes one single step.
An example of RGB values is:
| # | 028 | 029 | 030 | 031 | 032 | 033 | 034 | 035 | 036 | 037 | 038 | 039
| R | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0
| G | 135 | 135 | 135 | 135 | 135 | 135 | 175 | 175 | 175 | 175 | 175 | 175
| B | 0 | 95 | 135 | 175 | 215 | 255 | 0 | 95 | 135 | 175 | 215 | 255
The blue-value-loop finishes at #033. The green-value-loop executes one single step and the blue-value-loop starts again at #034.
After that it's an iteration through grey values at an interval of 10.
It starts with RGB(8, 8, 8), then RGB(18, 18, 18), then RGB(28, 28, 28) and so forth for 24 colors, which yields RGB(238, 238, 238) as the lightest grey.
Result:
Code to reproduce (Delphi):
procedure TForm1.FormCreate(Sender: TObject);
const gradient: array[0..5] of integer = (0, 95, 135, 175, 215, 255);
var
red, green, blue: integer;
col, row: integer;
i, j: integer;
begin
row := 0;
// iterate base colors
for col := 1 to 8 do begin
if col mod 2 = 0 then red := 85 else red := 255;
if Math.floor(col / 2) mod 2 = 0 then green := 85 else green := 255;
if Math.floor(col / 4) <= 0 then blue := 85 else blue := 255;
PaintColorRect(row, col, red, green, blue);
end;
row := 1;
// iterate gradient colors
for i := 0 to 5 do begin
red := gradient[i];
for j := 0 to 5 do begin
green := gradient[j];
for col := 0 to 5 do begin
blue := gradient[col];
PaintColorRect(row, col, red, green, blue);
end;
row := row+1;
end;
end;
// iterate grey values
red := 8;
green := 8;
blue := 8;
for i := 0 to 3 do begin
for col := 0 to 5 do begin
PaintColorRect(row, col, red, green, blue);
red := red + 10;
green := red;
blue := red;
end;
row := row+1;
end;
end;
procedure TForm1.PaintColorRect(row, col, red, green, blue: integer);
begin
Image1.Canvas.Brush.Color := RGB(red, green, blue);
Image1.Canvas.FillRect(Rect(col*60, row*20, (col+1)*60, (row+1)*20));
end;
I know Delphi is not the most widespread programming language ;-) so I'll see if I can reproduce the same program in C#.