Returns true if the current STDOUT supports the use of colour control codes.
15240
public static function supports_colour()
    {
        // Special case for buildbot
        if (isset($_ENV['_']) && strpos($_ENV['_'], 'buildbot') !== false) {
            return false;
        }

        if (!defined('STDOUT')) {
            define('STDOUT', fopen("php://stdout", "w"));
        }
        return function_exists('posix_isatty') ? @posix_isatty(STDOUT) : false;
    }
929048
private boolean isInWhiteList(String tpl)
	{
		if ((!whiteList.isEmpty() && whiteList.contains(tpl))
				|| (whiteList.isEmpty())) {
			return true;
		}
		return false;
	}
356621
public static function isSupportColor(): bool
    {
        if (DIRECTORY_SEPARATOR === '\\') {
            return
                '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR . '.' . PHP_WINDOWS_VERSION_MINOR . '.' . PHP_WINDOWS_VERSION_BUILD
                || false !== getenv('ANSICON')
                || 'ON' === getenv('ConEmuANSI')
                || 'xterm' === getenv('TERM')// || 'cygwin' === getenv('TERM')
                ;
        }

        if (!\defined('STDOUT')) {
            return false;
        }

        return self::isInteractive(STDOUT);
    }
778113
def supported(cls, stream=sys.stdout):
        
        if not stream.isatty():
            return False  # auto color only on TTYs
        try:
            import curses
        except ImportError:
            return False
        else:
            try:
                try:
                    return curses.tigetnum("colors") > 2
                except curses.error:
                    curses.setupterm()
                    return curses.tigetnum("colors") > 2
            except:
                raise
                # guess false in case of error
                return False
129432
def valid_color(x: str) -> bool:
    
    if isinstance(x, str) and re.match(COLOR_PATTERN, x):
        return True
    else:
        return False
846194
def stdout_display():
    
    if sys.version_info[0] == 2:
        yield SmartBuffer(sys.stdout)
    else:
        yield SmartBuffer(sys.stdout.buffer)
432093
def is_printable(c):
    ''''''
    global have_ascii
    if have_ascii:
        return ascii.isprint(c)
    if isinstance(c, int):
        ic = c
    else:
        ic = ord(c)
    return ic >= 32 and ic <= 126
416659
def file_supports_color(file_obj):
    
    plat = sys.platform
    supported_platform = plat != 'Pocket PC' and (plat != 'win32' or
                                                  'ANSICON' in os.environ)

    is_a_tty = file_is_a_tty(file_obj)

    return (supported_platform and is_a_tty)
13006
private function isWindowsTrueColor()
    {
        $result = 183 <= getenv('ANSICON_VER')
            || 'ON' === getenv('ConEmuANSI')
            || 'xterm' === getenv('TERM')
            || 'Hyper' === getenv('TERM_PROGRAM');

        if (!$result && \PHP_VERSION_ID >= 70200) {
            $version = sprintf(
                '%s.%s.%s',
                PHP_WINDOWS_VERSION_MAJOR,
                PHP_WINDOWS_VERSION_MINOR,
                PHP_WINDOWS_VERSION_BUILD
            );
            $result = $version >= '10.0.15063';
        }

        return $result;
    }
163620
private boolean isClang() {
    final String command = getCommand();
    if (command == null) {
      return false;
    }
    if (command.startsWith("clang")) {
      return true;
    }
    if (!GPP_COMMAND.equals(command)) {
      return false;
    }
    final String[] cmd = {
        command, "--version"
    };
    final String[] cmdout = CaptureStreamHandler.execute(cmd).getStdout();
    return cmdout != null && cmdout.length > 0 && cmdout[0].contains("(clang-");
  }
538957
def has_control_chars(i):
        
        if not hasattr(i, 'type_'):
            return False

        if i.type_ != Type.string:
            return False

        if i.token in ('VAR', 'PARAMDECL'):
            return True  # We don't know what an alphanumeric variable will hold

        if i.token == 'STRING':
            for c in i.value:
                if 15 < ord(c) < 22:  # is it an attr char?
                    return True
            return False

        for j in i.children:
            if Translator.has_control_chars(j):
                return True

        return False
1143504
def plain_output(message, color)
      if @options['without-color']
        puts message
      else
        puts Colorize.send(color, message)
      end
    end
198373
def isKeyboardShown(self):
        '''
        
        '''

        self.__checkTransport()
        dim = self.shell('dumpsys input_method')
        if dim:
            # FIXME: API >= 15 ?
            return "mInputShown=true" in dim
        return False
1139213
def has_color(self):
        """"""
        if (self.get_value(CONST.STATUSES_KEY).get('color_mode')
                == str(CONST.COLOR_MODE_ON)):
            return True
        return False
1161733
def disable_if_no_tty(cls):
        
        if sys.stdout.isatty() or sys.stderr.isatty():
            return False
        cls.disable_all_colors()
        return True
810251
def check_theme(theme):
        
        terminal_colors = curses.COLORS if curses.has_colors() else 0

        if theme.required_colors > terminal_colors:
            return False
        elif theme.required_color_pairs > curses.COLOR_PAIRS:
            return False
        else:
            return True
480408
public boolean validateHexColor(String hexColor, DiagnosticChain diagnostics, Map<Object, Object> context) {
		boolean result = validateHexColor_Pattern(hexColor, diagnostics, context);
		return result;
	}