From: Arthur Axel "fREW" Schmidt Date: Sat, 23 Oct 2010 17:10:06 +0000 (+0000) Subject: make console color profile a bit easier to read X-Git-Tag: v1.70~24 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6d388c842254484e584238298fdfe3f466b88031;p=dbsrgits%2FSQL-Abstract.git make console color profile a bit easier to read --- diff --git a/lib/SQL/Abstract/Tree.pm b/lib/SQL/Abstract/Tree.pm index daf0ae9..e3eba08 100644 --- a/lib/SQL/Abstract/Tree.pm +++ b/lib/SQL/Abstract/Tree.pm @@ -173,43 +173,51 @@ my %profiles = ( indent_amount => 2, newline => "\n", colormap => {}, - indentmap => { %indents }, + indentmap => \%indents, eval { require Term::ANSIColor } ? do { my $c = \&Term::ANSIColor::color; + + my $red = [$c->('red') , $c->('reset')]; + my $cyan = [$c->('cyan') , $c->('reset')]; + my $green = [$c->('green') , $c->('reset')]; + my $yellow = [$c->('yellow') , $c->('reset')]; + my $blue = [$c->('blue') , $c->('reset')]; + my $magenta = [$c->('magenta'), $c->('reset')]; + my $b_o_w = [$c->('black on_white'), $c->('reset')]; ( placeholder_surround => [q(') . $c->('black on_magenta'), $c->('reset') . q(')], colormap => { - 'begin work' => [$c->('black on_white'), $c->('reset')], - commit => [$c->('black on_white'), $c->('reset')], - rollback => [$c->('black on_white'), $c->('reset')], - savepoint => [$c->('black on_white'), $c->('reset')], - 'rollback to savepoint' => [$c->('black on_white'), $c->('reset')], - 'release savepoint' => [$c->('black on_white'), $c->('reset')], - - 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')], - - skip => [$c->('green'), $c->('reset')], - first => [$c->('green'), $c->('reset')], - limit => [$c->('green'), $c->('reset')], - offset => [$c->('green'), $c->('reset')], + 'begin work' => $b_o_w, + commit => $b_o_w, + rollback => $b_o_w, + savepoint => $b_o_w, + 'rollback to savepoint' => $b_o_w, + 'release savepoint' => $b_o_w, + + select => $red, + 'insert into' => $red, + update => $red, + 'delete from' => $red, + + set => $cyan, + from => $cyan, + + where => $green, + values => $yellow, + + join => $magenta, + 'left join' => $magenta, + on => $blue, + + 'group by' => $yellow, + 'order by' => $yellow, + + skip => $green, + first => $green, + limit => $green, + offset => $green, } ); } : (), @@ -221,7 +229,7 @@ my %profiles = ( indent_amount => 2, newline => "\n", colormap => {}, - indentmap => { %indents }, + indentmap => \%indents, }, html => { fill_in_placeholders => 1, @@ -260,7 +268,7 @@ my %profiles = ( 'rollback to savepoint' => ['', ''], 'release savepoint' => ['', ''], }, - indentmap => { %indents }, + indentmap => \%indents, }, none => { colormap => {},