addColor

@param   string $name    The color name.
@param   string $fg      Foreground color.
@param   string $bg      Background color.
@param   array  $options Style options.

@return  static
433071
public function addColor($name, $fg, $bg, $options = [])
    {
        if ($this->output instanceof ColorfulOutputInterface) {
            $this->output->getProcessor()->addStyle($name, new ColorStyle($fg, $bg, $options));
        }

        return $this;
    }
374735
public static function addName(string $name, string $handlerClass, array $option = [])
    {
        static::$handlers[$name] = BeanFactory::newInstance($handlerClass, $option);
    }
626606
public static function colorize($string, $fg = null, $at = null, $bg = null)
    {
        // Shell not supported, exit early
        if (!static::isSupportedShell()) {
            return $string;
        }

        $colored = '';

        // Check if given foreground color is supported
        if (isset(static::$_fg[$fg])) {
            $colored .= "\033[" . static::$_fg[$fg] . "m";
        }

        // Check if given background color is supported
        if (isset(static::$_bg[$bg])) {
            $colored .= "\033[" . static::$_bg[$bg] . "m";
        }

        // Check if given attribute is supported
        if (isset(static::$_at[$at])) {
            $colored .= "\033[" . static::$_at[$at] . "m";
        }

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

        return $colored;
    }
267907
public function addByArray(string $name, array $styleConfig): self
    {
        $style = [
            'fg'      => '',
            'bg'      => '',
            'extra'   => false,
            'options' => []
        ];

        $config = \array_merge($style, $styleConfig);
        [$fg, $bg, $extra, $options] = \array_values($config);

        $this->styles[$name] = Color::make($fg, $bg, $options, (bool)$extra);

        return $this;
    }
990716
private function addErrorClass($name, &$options = [])
    {
        if (isset($options['class'])) {
            $options['class'] .= ($this->hasError($name) ? ' error' : '');
        } elseif ($this->hasError($name)) {
            $options['class'] = 'error';
        }
    }
948368
public function foreColor($r, $g, $b) {
        $this->renderer->setForegroundColor(new Rgb($r, $g, $b));

        return $this;
    }
661336
private function color($text, $fg, $bg = null)
    {
        if ($this->getConfig('use-colors')) {
            
            $colors = [];
            
            if ($fg != 'none') {
                $colors[] = sprintf('fg=%s', $fg);
            }
            
            if ($bg && $bg != 'none') {
                $colors[] = sprintf('bg=%s', $bg);
            }
            
            if (!empty($colors)) {
                return sprintf('<%s>%s</>', implode(';', $colors), $text);
            }
        }
        
        return $text;
    }
1234490
public static function make(string $fg = '', string $bg = '', array $options = []): Color
    {
        return new self($fg, $bg, $options);
    }
1042156
public function style($name, $color = null, $background = null, $format = null, $allowInheritance = null) {
        $style = new ConsoleStyle($name, $color, $background, $format, $allowInheritance);
        $this->addStyle($style);

        return $style;
    }
1352466
public static function colorize($text, $fgcolor = null, $bgcolor = null)
    {
        $colors = '';
        if ($bgcolor) {
            $colors .= self::getBgColorString(self::getColorCode($bgcolor));
        }
        if ($fgcolor) {
            $colors .= self::getFgColorString(self::getColorCode($fgcolor));
        }
        if ($colors) {
            $text = $colors . $text . self::RESET;
        }
        return $text;
    }
518850
public function fg($color)
    {
        Assert::nullOrOneOf($color, self::$colors, 'The color must be null or one of the Style::* color constants. Got: "%s"');

        $this->fgColor = $color;

        return $this;
    }
668585
protected function addButton($builder, $name, $config)
    {
        $options = (isset($config['options']))? $config['options'] : array();
        $builder->add($name, $config['type'], $options);
    }
731248
function addArgument($name, $options = array())
    {
        $arg = new Argument($name, $options);
        $this->args[] = $arg;

        return $this;
    }
614726
public function column($name, $type = null, $options = [])
    {
        return $this->addColumn($name, $type, $options);
    }
692566
public function addField(string $name, $type, array $options = [])
    {
        $this->fields[$name] = array_merge($options, ['type' => $type]);
        if (!isset($options['argument']) || $options['argument'] !== false) {
            $this->arguments[$name] = array_merge($options, ['type' => $type]);
        }

        return $this;
    }
71173
public static function __callstatic($name, $params)
    {
        if (array_key_exists($name, TextColorManager::getKnownColors())) {
            return TextColorManager::$name($params);
        }

        if (BackgroundColorManager::isBackgroundCall($name)) {
            return BackgroundColorManager::$name($params);
        }

        if (in_array($name, BorderManager::getKnownBorders())) {
            return BorderManager::$name($params);
        }

        if (in_array($name, StructureManager::getDisplayableStructures())) {
            return StructureManager::$name($params);
        }

        if (array_key_exists($name, StyleManager::getKnownStyles())) {
            return StyleManager::$name($params);
        }

        if (FigletManager::isFigletCall($name)) {
            return FigletManager::$name($params);
        }

        throw new Exception("Unknown function name $name");
    }
927372
public function color($red, $green, $blue)
    {
        $this->writer->getRenderer()->setForegroundColor(new Rgb($red, $green, $blue));

        return $this;
    }