From 65b5ac2612ac6f6741634a9d54f34a7ba9975fbb Mon Sep 17 00:00:00 2001 From: gitlost Date: Sun, 30 Jul 2017 23:14:43 +0100 Subject: [PATCH] Fix reverse (inverse) and white (grey). --- lib/cli/Colors.php | 8 ++++---- tests/test-colors.php | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 tests/test-colors.php diff --git a/lib/cli/Colors.php b/lib/cli/Colors.php index e764ec8..6b0a64d 100644 --- a/lib/cli/Colors.php +++ b/lib/cli/Colors.php @@ -231,7 +231,7 @@ static public function getColors() { '%p' => array('color' => 'magenta'), '%m' => array('color' => 'magenta'), '%c' => array('color' => 'cyan'), - '%w' => array('color' => 'grey'), + '%w' => array('color' => 'white'), '%k' => array('color' => 'black'), '%n' => array('color' => 'reset'), '%Y' => array('color' => 'yellow', 'style' => 'bright'), @@ -241,7 +241,7 @@ static public function getColors() { '%P' => array('color' => 'magenta', 'style' => 'bright'), '%M' => array('color' => 'magenta', 'style' => 'bright'), '%C' => array('color' => 'cyan', 'style' => 'bright'), - '%W' => array('color' => 'grey', 'style' => 'bright'), + '%W' => array('color' => 'white', 'style' => 'bright'), '%K' => array('color' => 'black', 'style' => 'bright'), '%N' => array('color' => 'reset', 'style' => 'bright'), '%3' => array('background' => 'yellow'), @@ -250,11 +250,11 @@ static public function getColors() { '%1' => array('background' => 'red'), '%5' => array('background' => 'magenta'), '%6' => array('background' => 'cyan'), - '%7' => array('background' => 'grey'), + '%7' => array('background' => 'white'), '%0' => array('background' => 'black'), '%F' => array('style' => 'blink'), '%U' => array('style' => 'underline'), - '%8' => array('style' => 'inverse'), + '%8' => array('style' => 'reverse'), '%9' => array('style' => 'bright'), '%_' => array('style' => 'bright') ); diff --git a/tests/test-colors.php b/tests/test-colors.php new file mode 100644 index 0000000..649d0ec --- /dev/null +++ b/tests/test-colors.php @@ -0,0 +1,27 @@ +assertSame( Colors::colorize( $str ), Colors::color( $color ) ); + if ( in_array( 'reset', $color ) ) { + $this->assertTrue( false !== strpos( $colored, '[0m' ) ); + } else { + $this->assertTrue( false === strpos( $colored, '[0m' ) ); + } + } + + function dataColors() { + $ret = array(); + foreach ( Colors::getColors() as $str => $color ) { + $ret[] = array( $str, $color ); + } + return $ret; + } +}