RosettaCodeData/Task/Colour-pinstripe-Display/Icon/colour-pinstripe-display.icon
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

30 lines
995 B
Text

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