From 2774479e22b86bfe47b1233065f4e1e04121c216 Mon Sep 17 00:00:00 2001 From: silverwizard Date: Fri, 29 Nov 2019 13:13:46 -0500 Subject: [PATCH] Added background colour settings and text colour settings --- CardGen.pl | 7 ++++--- shopping.yml | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CardGen.pl b/CardGen.pl index e5ef5df..c269ce3 100644 --- a/CardGen.pl +++ b/CardGen.pl @@ -7,10 +7,11 @@ $Text::Wrap::columns = 30; my $cards = LoadFile('shopping.yml'); $bgcolour = $cards->{Deck}->{Background}; $mainfont = $cards->{Deck}->{Font}; +$txtcolour = $cards->{Deck}->{TextColour}; foreach my $card (keys %{$cards->{Deck}->{Cards}}){ my $image = Image::Magick->new(size=>'600x825'); - $image->ReadImage('canvas:white'); + $image->ReadImage('canvas:' . $bgcolour); $image->Draw(stroke=>'red', fill => 'none', strokewidth=>1, primitive=>'rectangle', points=>'38,38 562,787'); my $surface = Image::Magick->new; $surface->Rotate(90); @@ -21,9 +22,9 @@ foreach my $card (keys %{$cards->{Deck}->{Cards}}){ foreach my $line (@{$cards->{Deck}->{Cards}->{$card}}){ $text = $text . wrap('', '', $line) . "\n"; } - $image->Annotate(text => $card, x => 50, y => 100, font => $mainfont, fill => 'black', pointsize => 60); + $image->Annotate(text => $card, x => 50, y => 100, font => $mainfont, fill => $txtcolour, pointsize => 60); my $newlines = () = $text =~ /(\n)/g; - $image->Annotate(text => $text, x => 50, y => (750-(25*$newlines)), font => $mainfont, fill => 'black', pointsize => 25); + $image->Annotate(text => $text, x => 50, y => (750-(25*$newlines)), font => $mainfont, fill => $txtcolour, pointsize => 25); $image->Write($card . '.png'); } diff --git a/shopping.yml b/shopping.yml index 7787292..3dc4402 100644 --- a/shopping.yml +++ b/shopping.yml @@ -1,6 +1,7 @@ Deck: - Background: White + Background: black Font: Courier + TextColour: white Cards: Leg Boost: - Grants +1d6 when jumping