> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/c/colour-pinstripe/display.md).

# Display

```ruby
require('GD')

func pinstripes(width = 1280, height = 720) {

    var im = %O<GD::Image>.new(width, height)
    var colors = [0, 255].variations_with_repetition(3)

    var paintcolors = colors.shuffle.map {|rgb|
        im.colorAllocate(rgb...)
    }

    var starty     = 0
    var barheight  = height//4

    for barwidth in (1..4) {
        for (
            var(startx = 0, colorindex = 0);
            startx + barwidth <= width;
            startx += barwidth
        ) {
            im.filledRectangle(startx, starty, startx+barwidth,
                starty + barheight - 1, paintcolors[colorindex++ % 8])
        }
        starty += barheight
    }

    return im
}

File('pinstripes.png').write(pinstripes().png, :raw)
```
