public function getColoredString(
        string $string,
        string $foreground_color = null,
        string $background_color = null,
        bool $header = true
    ):string {
        if ($header) {
            $title = "Console Manager - ".CoreManager::getCurrentModule();
            $titleSeparator = $this->copyContent("-", strlen($title) + 10);
            $string = "\n\n" . $title . "\n" . $titleSeparator . "\n\n" . $string . "\n";
        } else {
            $string = "\n\n" . $string . "\n";
        }
        $string = $this->resizeContent($string);
        $colored_string = "";


        // Check if given foreground color found
        if (isset($this->foreground_colors[$foreground_color])) {
            $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m";
        }
        // Check if given background color found
        if (isset($this->background_colors[$background_color])) {
            $colored_string .= "\033[" . $this->background_colors[$background_color] . "m";
        }

        // Add string and end coloring
        $colored_string .=  $string . "\033[0m";

        return ($colored_string);
    }
public function getColoredString(
        string $string,
        string $foreground_color = null,
        string $background_color = null,
        bool $header = true
    ):string {
        if ($header) {
            $title = "Console Manager - ".CoreManager::getCurrentModule();
            $titleSeparator = $this->copyContent("-", strlen($title) + 10);
            $string = "\n\n" . $title . "\n" . $titleSeparator . "\n\n" . $string . "\n";
        } else {
            $string = "\n\n" . $string . "\n";
        }
        $string = $this->resizeContent($string);
        $colored_string = "";


        // Check if given foreground color found
        if (isset($this->foreground_colors[$foreground_color])) {
            $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m";
        }
        // Check if given background color found
        if (isset($this->background_colors[$background_color])) {
            $colored_string .= "\033[" . $this->background_colors[$background_color] . "m";
        }

        // Add string and end coloring
        $colored_string .=  $string . "\033[0m";

        return ($colored_string);
    }
public function getColoredString ( string $ string , string $ foreground_color = null , string $ background_color = null , bool $ header = true ) : string { if ( $ header ) { $ title = "Console Manager - " . CoreManager :: getCurrentModule ( ) ; $ titleSeparator = $ this -> copyContent ( "-" , strlen ( $ title ) + 10 ) ; $ string = "\n\n" . $ title . "\n" . $ titleSeparator . "\n\n" . $ string . "\n" ; } else { $ string = "\n\n" . $ string . "\n" ; } $ string = $ this -> resizeContent ( $ string ) ; $ colored_string = "" ; // Check if given foreground color found if ( isset ( $ this -> foreground_colors [ $ foreground_color ] ) ) { $ colored_string .= "\033[" . $ this -> foreground_colors [ $ foreground_color ] . "m" ; } // Check if given background color found if ( isset ( $ this -> background_colors [ $ background_color ] ) ) { $ colored_string .= "\033[" . $ this -> background_colors [ $ background_color ] . "m" ; } // Add string and end coloring $ colored_string .= $ string . "\033[0m" ; return ( $ colored_string ) ; }
Return colored string
@param string $string message
@param string|null $foreground_color Foreground color
@param string|null $background_color Background color
@param bool $header If header is present
@return string Colored string
Return colored string