public function setForeground($color = null)
    {
        if (null === $color) {
            $this->foreground = null;
            return;
        }
        if (!isset(static::$availableForegroundColors[$color])) {
            throw new \InvalidArgumentException(sprintf(
                'Invalid foreground color specified: "%s". Expected one of (%s)',
                $color,
                implode(', ', array_keys(static::$availableForegroundColors))
            ));
        }
        $this->foreground = static::$availableForegroundColors[$color];
    }
public function setForeground($color = null)
    {
        if (null === $color) {
            $this->foreground = null;
            return;
        }
        if (!isset(static::$availableForegroundColors[$color])) {
            throw new \InvalidArgumentException(sprintf(
                'Invalid foreground color specified: "%s". Expected one of (%s)',
                $color,
                implode(', ', array_keys(static::$availableForegroundColors))
            ));
        }
        $this->foreground = static::$availableForegroundColors[$color];
    }
public function setForeground ( $ color = null ) { if ( null === $ color ) { $ this -> foreground = null ; return ; } if ( ! isset ( static :: $ availableForegroundColors [ $ color ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Invalid foreground color specified: "%s". Expected one of (%s)' , $ color , implode ( ', ' , array_keys ( static :: $ availableForegroundColors ) ) ) ) ; } $ this -> foreground = static :: $ availableForegroundColors [ $ color ] ; }
Sets style foreground color.

@param string|null $color The color name

@throws \InvalidArgumentException When the color name isn't defined
Sets style foreground color .