> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/perl6-rosettacode/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/perl6-rosettacode/programming_tasks/c/colour-bars/display.md).

# Display

```perl
my ($x,$y) = 1280, 720;

my @colors = map -> $r, $g, $b { Buf.new: |(($r, $g, $b) xx $x div 8) },
      0,   0,   0,
    255,   0,   0,
      0, 255,   0,
      0,   0, 255,
    255,   0, 255,
      0, 255, 255,
    255, 255,   0,
    255, 255, 255;

my $img = open "colorbars.ppm", :w orelse die "Can't create colorbars.ppm: $_";

$img.print: qq:to/EOH/;
    P6
    # colorbars.ppm
    $x $y
    255
    EOH

for ^$y {
    for ^@colors -> $h {
        $img.write: @colors[$h];
    }
}

$img.close;
```
