summaryrefslogtreecommitdiff
path: root/lib/TextPrinter
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2010-11-23 22:52:49 +0000
committerdakkar <dakkar@thenautilus.net>2010-11-23 22:52:49 +0000
commit396d371b4c2798a1a7137274de68c271a7c86616 (patch)
tree79979a81c16edb5f63c41fb1df6fad38f4609a6e /lib/TextPrinter
parentfiller! (diff)
downloadqr-builder-396d371b4c2798a1a7137274de68c271a7c86616.tar.gz
qr-builder-396d371b4c2798a1a7137274de68c271a7c86616.tar.bz2
qr-builder-396d371b4c2798a1a7137274de68c271a7c86616.zip
the filler works, and we have two printers
Diffstat (limited to 'lib/TextPrinter')
-rw-r--r--lib/TextPrinter/ColourGrid.pm27
-rw-r--r--lib/TextPrinter/StarGrid.pm19
2 files changed, 46 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;
diff --git a/lib/TextPrinter/StarGrid.pm b/lib/TextPrinter/StarGrid.pm
new file mode 100644
index 0000000..012cf07
--- /dev/null
+++ b/lib/TextPrinter/StarGrid.pm
@@ -0,0 +1,19 @@
+package TextPrinter::StarGrid;
+use Moose;
+use namespace::autoclean;
+use Term::ANSIColor;
+
+extends 'TextPrinter';
+
+my %colours = (
+ '*' => color('white','on_black'),
+ ' ' => color('black','on_white'),
+);
+
+sub draw_cell {
+ my ($self,$cell) = @_;
+
+ print $colours{$cell},' ';
+}
+
+1;