bug #27794 Add color support for Hyper terminal . (azjezz)

This PR was submitted for the master branch but it was merged into the 2.8 branch instead (closes #27794).

Discussion
----------

Add color support for Hyper terminal .

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

Added color support for [Hyper terminal](https://hyper.is), also shade characters support for progress bar.

![image](https://user-images.githubusercontent.com/29315886/42135797-6edb8492-7d50-11e8-968b-2dd19981dcdd.png)

Commits
-------

2ab7bcf797 Add color support for Hyper terminal .
This commit is contained in:
Fabien Potencier 2018-07-03 09:19:37 +02:00
commit ae0a69a767
4 changed files with 9 additions and 5 deletions

View File

@ -231,7 +231,8 @@ class DeprecationErrorHandler
&& sapi_windows_vt100_support(STDOUT))
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');
|| 'xterm' === getenv('TERM')
|| 'Hyper' === getenv('TERM_PROGRAM');
}
if (function_exists('stream_isatty')) {

View File

@ -98,7 +98,8 @@ class StreamOutput extends Output
&& @sapi_windows_vt100_support($this->stream))
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');
|| 'xterm' === getenv('TERM')
|| 'Hyper' === getenv('TERM_PROGRAM');
}
if (function_exists('stream_isatty')) {

View File

@ -271,7 +271,7 @@ class SymfonyStyle extends OutputStyle
{
$progressBar = parent::createProgressBar($max);
if ('\\' !== DIRECTORY_SEPARATOR) {
if ('\\' !== DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
$progressBar->setEmptyBarCharacter('░'); // light shade character \u2591
$progressBar->setProgressCharacter('');
$progressBar->setBarCharacter('▓'); // dark shade character \u2593

View File

@ -484,7 +484,8 @@ class CliDumper extends AbstractDumper
&& @sapi_windows_vt100_support($stream))
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');
|| 'xterm' === getenv('TERM')
|| 'Hyper' === getenv('TERM_PROGRAM');
}
if (function_exists('stream_isatty')) {
@ -513,7 +514,8 @@ class CliDumper extends AbstractDumper
{
$result = 183 <= getenv('ANSICON_VER')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');
|| 'xterm' === getenv('TERM')
|| 'Hyper' === getenv('TERM_PROGRAM');
if (!$result && PHP_VERSION_ID >= 70200) {
$version = sprintf(