The task is to create 1 pixel wide coloured vertical pinstripes with a sufficient number of pinstripes to span the entire width of the graphics display.



The pinstripes should either follow the system palette sequence,   or a sequence that includes:

black,   red,   green,   blue,   magenta,   cyan,   yellow,   and   white:

   after filling the top quarter, switch to a wider 2 pixel wide vertical pinstripe pattern,
   halfway down the display, switch to 3 pixel wide vertical pinstripe,
   finally to a 4 pixels wide vertical pinstripe for the last quarter of the display.


See also

   display black and white 
   print colour


open Graphics
 
let () =
  open_graph "";
  let width = size_x ()
  and height = size_y () in
  let colors = [| black; red; green; blue; magenta; cyan; yellow; white |] in
  let num_colors = Array.length colors in
  let h = height / 4 in
  for i = 1 to 4 do
    let j = 4 - i in
    for x = 0 to pred width do
      set_color colors.((x / i) mod num_colors);
      moveto x (j * h); lineto x (j * h + h);
    done
  done;
  ignore(read_key())