lithium\console\Response::styles()

public method

Handles styling output. Uses ANSI escape sequences for colorization. These may not always be supported (i.e. on Windows).

Parameters

  • array|boolean $styles

Returns

array

Source

	public function styles($styles = []) {
		$defaults = [
			'end'    => "\033[0m",
			'black'  => "\033[0;30m",
			'red'    => "\033[0;31m",
			'green'  => "\033[0;32m",
			'yellow' => "\033[0;33m",
			'blue'   => "\033[0;34m",
			'purple' => "\033[0;35m",
			'cyan'   => "\033[0;36m",
			'white'  => "\033[0;37m",
			'heading' => "\033[1;36m",
			'option'  => "\033[0;35m",
			'command' => "\033[0;35m",
			'error'   => "\033[0;31m",
			'success' => "\033[0;32m",
			'bold'    => "\033[1m",
		];
		if ($styles === false || $this->plain || strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
			return array_combine(array_keys($defaults), array_pad([], count($defaults), null));
		}
		return $styles + $defaults;
	}