Gives the given string the given style

@param  string $string
@param  int|Style    $style

@return string
330629
public static function style($string, $style)
    {
        $escapeSequence = ($style instanceof Style) ? $style->getEscapeSequence() : self::getEscapeSequence($style);
        $resetSequence = ($style instanceof Style) ? Style::getResetSequence() : self::getResetSequence($style);

        return $escapeSequence . $string . $resetSequence;
    }
807896
public function apply(string $style, string $text): string
    {
        return $this->format(self::wrap($text, $style));
    }
112285
public function process($string)
    {
        preg_match_all($this->tagFilter, $string, $matches);

        if (!$matches) {
            return $string;
        }

        foreach ($matches[0] as $i => $m) {
            if (array_key_exists($matches[1][$i], $this->styles)) {
                $string = $this->replaceColors(
                    $string,
                    $matches[1][$i],
                    $matches[2][$i],
                    $this->styles[$matches[1][$i]]
                );
            } elseif (strpos($matches[1][$i], '=')) {
                // Custom format
                $string = $this->replaceColors(
                    $string,
                    $matches[1][$i],
                    $matches[2][$i],
                    ColorStyle::fromString($matches[1][$i])
                );
            }
        }

        return $string;
    }
33942
protected function setStyle($style)
    {
        if (is_string($style) === false) {
            throw new \InvalidArgumentException(
                'The style label must be a string.'
            );
        }
        if (!in_array($style, $this->STYLES)) {
            throw new \InvalidArgumentException(
                'Invalid style.'
            );
        }

        $this->style = $style;

        return $this;
    }
1070284
function styleObjectToString(style) {
      return Object.keys(style).reduce(function (acc, prop) {
        return (acc + " " + prop + ": " + (style[prop]) + ";")
      }, '')
    }
566114
public function setStyle($style)
    {
        if (!is_string($style)) {
            $style = json_encode($style);
        }
        $this->entity->setStyle($style);

        return $this;
    }
479532
public function addStyleId($styleId)
    {
        $styleId = (string)$styleId;
        if (!in_array($styleId, $this->styleIds)) {
            array_push($this->styleIds, $styleId);
        }
        return $this;
    }
1347072
static String getStyle(Element element, String styleName) {
		String value = element.getAttribute(styleName);
		
		if ((value != null) && (value.length() > 0)) {
			return value;
		}
		
		String style = element.getAttribute("style");
		return extractStyle(style, styleName);
	}
277161
protected function changeCase($string)
    {
        if ($this->isLowercase()) {
            return strtolower($string);
        }

        if ($this->isUppercase()) {
            return strtoupper($string);
        }

        return $string;
    }
1192622
private function createStyleFromString($string) {
        if (isset($this->styles[$string])) {
            return $this->styles[$string];
        }

        if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
            return false;
        }

        $style = new Style();
        foreach ($matches as $match) {
            array_shift($match);

            if ('fg' == $match[0]) {
                $style->setForeground($match[1]);
            }
            elseif ('bg' == $match[0]) {
                $style->setBackground($match[1]);
            }
            else {
                try {
                    $style->setOption($match[1]);
                }
                catch (\InvalidArgumentException $e) {
                    return false;
                }
            }
        }

        return $style;
    }
1018898
public function line($string, $style = null, $verbosity = null)
    {
        $styled = $style ? "<$style>$string</$style>" : $string;

        $this->writeln($styled, $this->parseVerbosity($verbosity));
    }
626475
public function style($style)
    {
        if (is_array($style)) {
            $style = implode('', array_map(function ($key, $val) {
                return "$key:$val";
            }, array_keys($style), array_values($style)));
        }

        if (is_string($style)) {
            $this->attributes['style'] = $style;
        }
    }
594
public function error(string $text, array $style = []): string
    {
        return $this->line($text, ['fg' => static::RED] + $style);
    }
651851
function make_styles_string($styles) {
        if (empty($styles)) {
            return null;
        }

        $string = '';
        foreach($styles as $property => $value) {
            $string .= $property . ':' . $value . ';';
        }
        return $string;
    }
1154975
public static function style($styleID)
    {
        if (!in_array($styleID, static::getKnownStyles())) {
            throw new Exception("Unknown style ID $styleID");
        }

        $style = new Style($styleID);

        return $style;
    }
137730
public function addStyle($style) {
        $style = trim($style);
        if ($style != '') {
            if (strpos($this->style, $style) === false) {
                $this->style .= " 
                $style ";
            }
        }
    }
236256
function stringifyStyle(style) {
  if (typeof style === 'string') {
    return style;
  }
  var values = [];
  for (var key in style) {
    values.push(key + ':' + style[key]);
  }
  return values.join(';');
}