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


link graphics,numbers,printf
 
procedure main()  # pinstripe
 
   &window := open("Colour Pinstripe","g","bg=black") |
      stop("Unable to open window")   
 
   WAttrib("canvas=hidden")
   WAttrib(sprintf("size=%d,%d",WAttrib("displaywidth"),WAttrib("displayheight")))
   WAttrib("canvas=maximal")
 
   Colours := ["black", "red", "green", "blue", "magenta", "cyan", "yellow", "white"]
   height := WAttrib("height")
   width  := WAttrib("width")
 
   maxbands := 4                             # bands to draw   
   bandheight := height / maxbands           # height of each band
   every bands := 1 to maxbands do {         # for each band
         top   := 1 + bandheight * (bands-1) # .. top of band
         every c := 1 to width do {
            colour := Colours[ceil((c+0.)/bands)%*Colours+1]
            if colour == "black" then next   # skip black
            else {
               Fg(colour)
               DrawLine(c,top,c,top+bandheight-1)
               }
         }
      }
   WDone()
end