summaryrefslogtreecommitdiff
path: root/lib/TextPrinter/ColourGrid.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/TextPrinter/ColourGrid.pm')
-rw-r--r--lib/TextPrinter/ColourGrid.pm27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/TextPrinter/ColourGrid.pm b/lib/TextPrinter/ColourGrid.pm
new file mode 100644
index 0000000..fdb9949
--- /dev/null
+++ b/lib/TextPrinter/ColourGrid.pm
@@ -0,0 +1,27 @@
+package TextPrinter::ColourGrid;
+use Moose;
+use namespace::autoclean;
+use Term::ANSIColor;
+
+extends 'TextPrinter';
+
+my @colours = (
+ color('reset'), # filler
+ (
+ map { color($_,'on_white') }
+ 'blue', 'green',
+ ),
+ (
+ map { color($_,'on_black') }
+ 'dark yellow','dark green',
+ ),
+);
+
+sub draw_cell {
+ my ($self,$cell) = @_;
+
+ print $colours[$cell->[0]],
+ $cell->[1];
+}
+
+1;