mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 07:54:19 +00:00
Automatically enable ANSI colours on Windows versions that support it
Note that stream_isatty() and sapi_windows_vt100_support() are ONLY defined on PHP 7.2, and the latter is only available on Windows.
This commit is contained in:
parent
30d2318bb7
commit
bdee746e46
@ -57,7 +57,13 @@ abstract class Terminal{
|
||||
if(isset($opts["disable-ansi"])){
|
||||
self::$formattingCodes = false;
|
||||
}else{
|
||||
self::$formattingCodes = ((Utils::getOS() !== "win" and getenv("TERM") != "" and (!function_exists("posix_ttyname") or !defined("STDOUT") or posix_ttyname(STDOUT) !== false)) or isset($opts["enable-ansi"]));
|
||||
self::$formattingCodes = (isset($opts["enable-ansi"]) or ( //user explicitly told us to enable ANSI
|
||||
stream_isatty(STDOUT) and //STDOUT isn't being piped
|
||||
(
|
||||
getenv('TERM') !== false or //Console says it supports colours
|
||||
(function_exists('sapi_windows_vt100_support') and sapi_windows_vt100_support(STDOUT)) //we're on windows and have vt100 support
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user