From d45cdc6cff00f33914376fd33cd149298b889e3d Mon Sep 17 00:00:00 2001 From: Mattia Basaglia Date: Sun, 16 Aug 2015 00:10:46 +0200 Subject: [PATCH] Fix output --- render_parts.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/render_parts.php b/render_parts.php index 80a21c0..24c3f40 100755 --- a/render_parts.php +++ b/render_parts.php @@ -201,6 +201,11 @@ class IRCColorOutput extends PlaintextColorOutput } function color( Color $color ) + { + return "\x03".$this->color_code($color); + } + + function color_code( Color $color ) { if ( $color->bright ) { @@ -239,9 +244,14 @@ class AnsiColorOutput extends PlainTextColorOutput } function color( Color $color ) + { + return "\x1b[".$this->color_code($color)."m"; + } + + function color_code( Color $color ) { $bold = $color->bright ? "1" : "22"; - return "\x1b[{$color->color};{$bold}m"; + return (30+$color->color).";{$bold}"; } } @@ -262,6 +272,11 @@ class BashColorOutput extends AnsiColorOutput { return $char == '\\' ? '\\\\' : $char; } + + function color( Color $color ) + { + return "\\x1b[".$this->color_code($color)."m"; + } } $dir = isset($argv[1]) ? $argv[1] : getcwd();