Update colors asset

This commit is contained in:
Maarten 2020-01-07 22:19:39 +01:00
parent dbe88b7f2b
commit 04aee8c5a3

View file

@ -7,43 +7,43 @@ trait Colors {
/** /**
* @var array * @var array
*/ */
private $foreground_colors = []; private $foreground = [];
/** /**
* @var array * @var array
*/ */
private $background_colors = []; private $background = [];
/** /**
* Colors constructor. * Colors constructor.
*/ */
private function setColors() private function setColors()
{ {
$this->foreground_colors['black'] = '0;30'; $this->foreground['black'] = '0;30';
$this->foreground_colors['dark_gray'] = '1;30'; $this->foreground['dark_gray'] = '1;30';
$this->foreground_colors['blue'] = '0;34'; $this->foreground['blue'] = '0;34';
$this->foreground_colors['light_blue'] = '1;34'; $this->foreground['light_blue'] = '1;34';
$this->foreground_colors['green'] = '0;32'; $this->foreground['green'] = '0;32';
$this->foreground_colors['light_green'] = '1;32'; $this->foreground['light_green'] = '1;32';
$this->foreground_colors['cyan'] = '0;36'; $this->foreground['cyan'] = '0;36';
$this->foreground_colors['light_cyan'] = '1;36'; $this->foreground['light_cyan'] = '1;36';
$this->foreground_colors['red'] = '0;31'; $this->foreground['red'] = '0;31';
$this->foreground_colors['light_red'] = '1;31'; $this->foreground['light_red'] = '1;31';
$this->foreground_colors['purple'] = '0;35'; $this->foreground['purple'] = '0;35';
$this->foreground_colors['light_purple'] = '1;35'; $this->foreground['light_purple'] = '1;35';
$this->foreground_colors['brown'] = '0;33'; $this->foreground['brown'] = '0;33';
$this->foreground_colors['yellow'] = '1;33'; $this->foreground['yellow'] = '1;33';
$this->foreground_colors['light_gray'] = '0;37'; $this->foreground['light_gray'] = '0;37';
$this->foreground_colors['white'] = '1;37'; $this->foreground['white'] = '1;37';
$this->background_colors['black'] = '40'; $this->background['black'] = '40';
$this->background_colors['red'] = '41'; $this->background['red'] = '41';
$this->background_colors['green'] = '42'; $this->background['green'] = '42';
$this->background_colors['yellow'] = '43'; $this->background['yellow'] = '43';
$this->background_colors['blue'] = '44'; $this->background['blue'] = '44';
$this->background_colors['magenta'] = '45'; $this->background['magenta'] = '45';
$this->background_colors['cyan'] = '46'; $this->background['cyan'] = '46';
$this->background_colors['light_gray'] = '47'; $this->background['light_gray'] = '47';
} }
/** /**
@ -59,14 +59,13 @@ trait Colors {
$colored_string = ""; $colored_string = "";
if (isset($this->foreground_colors[$foreground])) { if (isset($this->foreground_colors[$foreground])) {
$colored_string .= "\033[" . $this->foreground_colors[$foreground] . "m"; $colored_string .= "\033[" . $this->foreground[$foreground] . "m";
} }
if (isset($this->background_colors[$background])) { if (isset($this->background_colors[$background])) {
$colored_string .= "\033[" . $this->background_colors[$background] . "m"; $colored_string .= "\033[" . $this->background[$background] . "m";
} }
$colored_string .= $string . "\033[0m"; $colored_string .= $string . "\033[0m";
return $colored_string; return $colored_string;