From: Peter Rabbitson Date: Tue, 21 Sep 2010 05:11:08 +0000 (+0000) Subject: Move the colordefs to the profile def X-Git-Tag: v1.70~56 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aafbf8335720772329ee0cfff8a66cd46146ceb2;p=dbsrgits%2FSQL-Abstract.git Move the colordefs to the profile def --- diff --git a/lib/SQL/Abstract/Tree.pm b/lib/SQL/Abstract/Tree.pm index aa8bc2f..4cede05 100644 --- a/lib/SQL/Abstract/Tree.pm +++ b/lib/SQL/Abstract/Tree.pm @@ -132,6 +132,33 @@ my %profiles = ( newline => "\n", colormap => {}, indentmap => { %indents }, + + eval { require Term::ANSIColor } + ? do { + my $c = \&Term::ANSIColor::color; + ( + placeholder_surround => [$c->('black on_cyan'), $c->('reset')], + colormap => { + select => [$c->('red'), $c->('reset')], + 'insert into' => [$c->('red'), $c->('reset')], + update => [$c->('red'), $c->('reset')], + 'delete from' => [$c->('red'), $c->('reset')], + + set => [$c->('cyan'), $c->('reset')], + from => [$c->('cyan'), $c->('reset')], + + where => [$c->('green'), $c->('reset')], + values => [$c->('yellow'), $c->('reset')], + + join => [$c->('magenta'), $c->('reset')], + 'left join' => [$c->('magenta'), $c->('reset')], + on => [$c->('blue'), $c->('reset')], + + 'group by' => [$c->('yellow'), $c->('reset')], + 'order by' => [$c->('yellow'), $c->('reset')], + } + ); + } : (), }, console_monochrome => { fill_in_placeholders => 1, @@ -171,33 +198,6 @@ my %profiles = ( }, ); -eval { - require Term::ANSIColor; - - $profiles{console}->{placeholder_surround} = - [Term::ANSIColor::color('black on_cyan'), Term::ANSIColor::color('reset')]; - - $profiles{console}->{colormap} = { - select => [Term::ANSIColor::color('red'), Term::ANSIColor::color('reset')], - 'insert into' => [Term::ANSIColor::color('red'), Term::ANSIColor::color('reset')], - update => [Term::ANSIColor::color('red'), Term::ANSIColor::color('reset')], - 'delete from' => [Term::ANSIColor::color('red'), Term::ANSIColor::color('reset')], - - set => [Term::ANSIColor::color('cyan'), Term::ANSIColor::color('reset')], - from => [Term::ANSIColor::color('cyan'), Term::ANSIColor::color('reset')], - - where => [Term::ANSIColor::color('green'), Term::ANSIColor::color('reset')], - values => [Term::ANSIColor::color('yellow'), Term::ANSIColor::color('reset')], - - join => [Term::ANSIColor::color('magenta'), Term::ANSIColor::color('reset')], - 'left join' => [Term::ANSIColor::color('magenta'), Term::ANSIColor::color('reset')], - on => [Term::ANSIColor::color('blue'), Term::ANSIColor::color('reset')], - - 'group by' => [Term::ANSIColor::color('yellow'), Term::ANSIColor::color('reset')], - 'order by' => [Term::ANSIColor::color('yellow'), Term::ANSIColor::color('reset')], - }; -}; - sub new { my $class = shift; my $args = shift || {};