public function add(string $name, $fg = '', $bg = '', array $options = [], bool $extra = false): self
    {
        if (\is_array($fg)) {
            return $this->addByArray($name, $fg);
        }

        if (\is_object($fg) && $fg instanceof Color) {
            $this->styles[$name] = $fg;
        } else {
            $this->styles[$name] = Color::make($fg, $bg, $options, $extra);
        }

        return $this;
    }
public function add(string $name, $fg = '', $bg = '', array $options = [], bool $extra = false): self
    {
        if (\is_array($fg)) {
            return $this->addByArray($name, $fg);
        }

        if (\is_object($fg) && $fg instanceof Color) {
            $this->styles[$name] = $fg;
        } else {
            $this->styles[$name] = Color::make($fg, $bg, $options, $extra);
        }

        return $this;
    }
public function add ( string $ name , $ fg = '' , $ bg = '' , array $ options = [ ] , bool $ extra = false ) : self { if ( \ is_array ( $ fg ) ) { return $ this -> addByArray ( $ name , $ fg ) ; } if ( \ is_object ( $ fg ) && $ fg instanceof Color ) { $ this -> styles [ $ name ] = $ fg ; } else { $ this -> styles [ $ name ] = Color :: make ( $ fg , $ bg , $ options , $ extra ) ; } return $ this ; }
Add a style.
@param string             $name
@param string|Color|array $fg 前景色|Color对象|也可以是style配置数组(@see self::addByArray())
当它为Color对象或配置数组时，后面两个参数无效
@param string             $bg 背景色
@param array              $options 其它选项
@param bool               $extra
@return $this
Add a style .