From e7d6d21b74710c60a789de4b6514e18077bfb05e Mon Sep 17 00:00:00 2001 From: Alexandre Morignot <erdnaxeli@cervoi.se> Date: Fri, 6 Feb 2015 17:39:41 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=AA=20You=20will=20see=20colors=20!=20?= =?UTF-8?q?=E2=99=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/utils/print.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/utils/print.pm b/lib/utils/print.pm index ed0b518..2b17bf7 100644 --- a/lib/utils/print.pm +++ b/lib/utils/print.pm @@ -2,6 +2,8 @@ package utils::print; use strict; +use IRC::Utils qw(YELLOW ORANGE GREEN NORMAL LIGHT_BLUE GREY); + # Used to print a content. # The public subroutine is print($content). # arg : @@ -18,7 +20,7 @@ use strict; sub print { my ($content) = @_; - my $msg = '['.$content->{'id'}.'] '.$content->{'title'}; + my $msg = YELLOW.'['.$content->{'id'}.'] '.GREEN.$content->{'title'}; if (defined $content->{'author'}) { $msg .= ' | '.$content->{'author'}; @@ -29,19 +31,21 @@ sub print { my $m = int(($content->{'duration'} % 3600) / 60); my $s = int(($content->{'duration'} % 3600) % 60); - $msg .= ' ('; + $msg .= LIGHT_BLUE.' ('; $msg .= sprintf("%02d:", $h) if ($h > 0); $msg .= sprintf("%02d:", $m); $msg .= sprintf("%02d", $s); - $msg .= ')'; + $msg .= ')'.NORMAL; } - $msg .= ' => '.$content->{'url'} if (defined $content->{'url'}); + $msg .= ' => '.$content->{'url'}.ORANGE if (defined $content->{'url'}); if (defined $content->{'tags'}) { $msg .= ' '.$_ foreach (@{$content->{'tags'}}); } + $msg .= GREY; + return $msg; } -- GitLab