src/Dev/CLI.php
public static function start_colour($fgColour = null, $bgColour = null, $bold = false)
    {
        if (!self::supports_colour()) {
            return "";
        }
        $colours = array(
            'black' => 0,
            'red' => 1,
            'green' => 2,
            'yellow' => 3,
            'blue' => 4,
            'magenta' => 5,
            'cyan' => 6,
            'white' => 7,
        );

        $prefix = "";

        if ($fgColour || $bold) {
            if (!$fgColour) {
                $fgColour = "white";
            }
            $prefix .= "\033[" . ($bold ? "1;" :"") . "3" . $colours[$fgColour] . "m";
        }


        if ($bgColour) {
            $prefix .= "\033[4" . $colours[$bgColour] . "m";
        }

        return $prefix;
    }
public static function start_colour($fgColour = null, $bgColour = null, $bold = false)
    {
        if (!self::supports_colour()) {
            return "";
        }
        $colours = array(
            'black' => 0,
            'red' => 1,
            'green' => 2,
            'yellow' => 3,
            'blue' => 4,
            'magenta' => 5,
            'cyan' => 6,
            'white' => 7,
        );

        $prefix = "";

        if ($fgColour || $bold) {
            if (!$fgColour) {
                $fgColour = "white";
            }
            $prefix .= "\033[" . ($bold ? "1;" :"") . "3" . $colours[$fgColour] . "m";
        }


        if ($bgColour) {
            $prefix .= "\033[4" . $colours[$bgColour] . "m";
        }

        return $prefix;
    }
public static function start_colour ( $ fgColour = null , $ bgColour = null , $ bold = false ) { if ( ! self :: supports_colour ( ) ) { return "" ; } $ colours = array ( 'black' => 0 , 'red' => 1 , 'green' => 2 , 'yellow' => 3 , 'blue' => 4 , 'magenta' => 5 , 'cyan' => 6 , 'white' => 7 , ) ; $ prefix = "" ; if ( $ fgColour || $ bold ) { if ( ! $ fgColour ) { $ fgColour = "white" ; } $ prefix .= "\033[" . ( $ bold ? "1;" : "" ) . "3" . $ colours [ $ fgColour ] . "m" ; } if ( $ bgColour ) { $ prefix .= "\033[4" . $ colours [ $ bgColour ] . "m" ; } return $ prefix ; }
Send control codes for changing text to the given colour
@param string $fgColour The foreground colour - black, red, green, yellow, blue, magenta, cyan, white.
Null is default.
@param string $bgColour The foreground colour - black, red, green, yellow, blue, magenta, cyan, white.
Null is default.
@param bool $bold A boolean variable - bold or not.
@return string
Send control codes for changing text to the given colour