Skip to content

Commit

Permalink
bug #27794 Add color support for Hyper terminal . (azjezz)
Browse files Browse the repository at this point in the history
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
-------

2ab7bcf Add color support for Hyper terminal .
  • Loading branch information
fabpot committed Jul 3, 2018
2 parents be8feaf + 2ab7bcf commit ae0a69a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
Expand Up @@ -231,7 +231,8 @@ private static function hasColorSupport()
&& 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')) {
Expand Down
3 changes: 2 additions & 1 deletion src/Symfony/Component/Console/Output/StreamOutput.php
Expand Up @@ -98,7 +98,8 @@ protected function hasColorSupport()
&& @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')) {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Style/SymfonyStyle.php
Expand Up @@ -271,7 +271,7 @@ public function createProgressBar($max = 0)
{
$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
Expand Down
6 changes: 4 additions & 2 deletions src/Symfony/Component/VarDumper/Dumper/CliDumper.php
Expand Up @@ -484,7 +484,8 @@ private function hasColorSupport($stream)
&& @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')) {
Expand Down Expand Up @@ -513,7 +514,8 @@ private function isWindowsTrueColor()
{
$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(
Expand Down

0 comments on commit ae0a69a

Please sign in to comment.