summaryrefslogtreecommitdiff
path: root/lib/TextPrinter/ColourGrid.pm
blob: 441956c4903e70a167048269296987336333f575 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package TextPrinter::ColourGrid; 
use Moose;
use namespace::autoclean;
use Term::ANSIColor;
 
extends 'TextPrinter';
 
my @colours = (
    color('reset'), # filler 
    (
        map { color($_,'on_black') }
            'dark yellow''dark green''dark red''dark white',
    ),
    (
        map { color($_,'on_white') }
            'blue''green''red''dark magenta',
    ),
);
 
sub draw_cell {
    my ($self,$cell) = @_;
 
    print $colours[$cell->[0]],
        $cell->[1];
}
 
1;