bug #15248 Added 'default' color (jaytaph)
This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes #15248).
Discussion
----------
Added 'default' color
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #15246
| License | MIT
| Doc PR |
Adding a "default" ansi color which corresponds to 39 and 49.
Commits
-------
c4bf2e6
Added 'default' color
This commit is contained in:
commit
86c6128f45
@ -29,6 +29,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
|||||||
'magenta' => 35,
|
'magenta' => 35,
|
||||||
'cyan' => 36,
|
'cyan' => 36,
|
||||||
'white' => 37,
|
'white' => 37,
|
||||||
|
'default' => 39,
|
||||||
);
|
);
|
||||||
private static $availableBackgroundColors = array(
|
private static $availableBackgroundColors = array(
|
||||||
'black' => 40,
|
'black' => 40,
|
||||||
@ -39,6 +40,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
|||||||
'magenta' => 45,
|
'magenta' => 45,
|
||||||
'cyan' => 46,
|
'cyan' => 46,
|
||||||
'white' => 47,
|
'white' => 47,
|
||||||
|
'default' => 49,
|
||||||
);
|
);
|
||||||
private static $availableOptions = array(
|
private static $availableOptions = array(
|
||||||
'bold' => 1,
|
'bold' => 1,
|
||||||
|
@ -37,6 +37,9 @@ class OutputFormatterStyleTest extends \PHPUnit_Framework_TestCase
|
|||||||
$style->setForeground('blue');
|
$style->setForeground('blue');
|
||||||
$this->assertEquals("\033[34mfoo\033[0m", $style->apply('foo'));
|
$this->assertEquals("\033[34mfoo\033[0m", $style->apply('foo'));
|
||||||
|
|
||||||
|
$style->setForeground('default');
|
||||||
|
$this->assertEquals("\033[39mfoo\033[39m", $style->apply('foo'));
|
||||||
|
|
||||||
$this->setExpectedException('InvalidArgumentException');
|
$this->setExpectedException('InvalidArgumentException');
|
||||||
$style->setForeground('undefined-color');
|
$style->setForeground('undefined-color');
|
||||||
}
|
}
|
||||||
@ -51,6 +54,9 @@ class OutputFormatterStyleTest extends \PHPUnit_Framework_TestCase
|
|||||||
$style->setBackground('yellow');
|
$style->setBackground('yellow');
|
||||||
$this->assertEquals("\033[43mfoo\033[0m", $style->apply('foo'));
|
$this->assertEquals("\033[43mfoo\033[0m", $style->apply('foo'));
|
||||||
|
|
||||||
|
$style->setBackground('default');
|
||||||
|
$this->assertEquals("\033[49mfoo\033[49m", $style->apply('foo'));
|
||||||
|
|
||||||
$this->setExpectedException('InvalidArgumentException');
|
$this->setExpectedException('InvalidArgumentException');
|
||||||
$style->setBackground('undefined-color');
|
$style->setBackground('undefined-color');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user