adds color to rtf document

@param string $color color
334179
public function add($color)
    {
        if (!empty($color)) {
            $color = self::getColorAsFullHexCode($color);
            if (!in_array($color, $this->_colors)) {
                $this->_colors[] = $color;
            }
        }
    }
100335
public function addColors($colors)
    {
        $args = func_get_args();
        foreach ($args as $arg) {
            if (is_array($arg)) {
                foreach ($arg as $color) {
                    $this->addColor($color);
                }
            } else {
                $this->addColor($arg);
            }
        }
    }
345073
public function getColorWithRGB($color) {
		if (func_num_args() == 1 && is_int($color)) {
			return $color;
		}
		if (is_string($color)) {
			$color = self::transformRGB($color);
		} elseif(func_num_args() == 3) {
			$color = func_get_args();
		}
		return imagecolorallocate($this->image, $color[0], $color[1], $color[2]);
	}
653731
protected static function intColorToLab($color)
    {
        return self::xyzToLab(
            self::srgbToXyz(
                self::rgbToSrgb(
                    [
                        'R' => ($color >> 16) & 0xFF,
                        'G' => ($color >> 8) & 0xFF,
                        'B' => $color & 0xFF,
                    ]
                )
            )
        );
    }
561974
public function setColor($color)
	{
		if (is_array($color))
		{
			$this->color[0] = $color[0];
			$this->color[1] = $color[1];
			$this->color[2] = $color[2];
		}
		else
		{
			if (false !== strpos($color, '#'))
			{
				$color = substr($color, 1);
			}
			$this->color[0] = hexdec(substr($color, 0, 2));
			$this->color[1] = hexdec(substr($color, 2, 2));
			$this->color[2] = hexdec(substr($color, 4, 2));
		}

		return $this;
	}
295597
function rgb($color) {
		if (is_string($color))
			$color=hexdec($color);
		$hex=str_pad($hex=dechex($color),$color<4096?3:6,'0',STR_PAD_LEFT);
		if (($len=strlen($hex))>6)
			user_error(sprintf(self::E_Color,'0x'.$hex),E_USER_ERROR);
		$color=str_split($hex,$len/3);
		foreach ($color as &$hue) {
			$hue=hexdec(str_repeat($hue,6/$len));
			unset($hue);
		}
		return $color;
	}
69289
public static function color($text, $color)
    {
        if (isset(ShellTool::$colors[$color])) {
            return ShellTool::$colors[$color]['start'] . $text . ShellTool::$colors[$color]['close'];
        } else {
            return $text;
        }
    }
857975
public function setBgColor($color)
    {
        if (!empty($color)) {
            $this->bgColor = $this->convertColor($color);
        }

        return $this;
    }
535062
protected function _set_stroke_color($color)
    {
        $this->_pdf->setStrokeColor($color);
        $alpha = isset($color["alpha"]) ? $color["alpha"] : 1;
        if ($this->_current_opacity != 1) {
            $alpha *= $this->_current_opacity;
        }
        $this->_set_line_transparency("Normal", $alpha);
    }
967498
private function setColour($colour)
    {
        if (!in_array($colour, $this->getDefaultColours()) &&
            !preg_match(
                '_^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$_',
                $colour
            )
        ) {
            throw new InvalidColourException(
                sprintf(
                    'The colour "%s" is not a valid colour. Possible options are "%s" or a valid hex colour',
                    $colour,
                    implode('", "', $this->getDefaultColours())
                )
            );
        }

        $this->colour = $colour;
    }
255936
function setStrokeColor($color, $force = false)
    {
        $new_color = array($color[0], $color[1], $color[2], isset($color[3]) ? $color[3] : null);

        if (!$force && $this->currentStrokeColor == $new_color) {
            return;
        }

        if (isset($new_color[3])) {
            $this->currentStrokeColor = $new_color;
            $this->addContent(vsprintf("\n%.3F %.3F %.3F %.3F K", $this->currentStrokeColor));
        } else {
            if (isset($new_color[2])) {
                $this->currentStrokeColor = $new_color;
                $this->addContent(vsprintf("\n%.3F %.3F %.3F RG", $this->currentStrokeColor));
            }
        }
    }
800418
protected function addColor(
        /*# string */ $text,
        array $definition
    )/*# : string */ {
        $fgColor = $definition[0];
        $bgColor = $definition[1];
        $deColor = $definition[2];
        $prefix  = $fgColor . $bgColor . $deColor;
        $suffix  = $prefix ? self::DECO_END : '';
        return $prefix . $text . $suffix;
    }
702073
function setColor($color, $force = false) {
    $new_color = array($color[0], $color[1], $color[2], isset($color[3]) ? $color[3] : null);
    
    if (!$force && $this->currentColour == $new_color) return;
    
    if (isset($new_color[3])) {
      $this->currentColour = $new_color;
      $this->objects[$this->currentContents]['c'] .= vsprintf("\n%.3F %.3F %.3F %.3F k", $this->currentColour);
    }

    elseif (isset($new_color[2])) {
      $this->currentColour = $new_color;
      $this->objects[$this->currentContents]['c'] .= vsprintf("\n%.3F %.3F %.3F rg", $this->currentColour);
    }
  }
371101
public void setTextColor(final Color COLOR) {
        if (null == textColor) {
            _textColor = COLOR;
            fireUpdateEvent(REDRAW_EVENT);
        } else {
            textColor.set(COLOR);
        }
    }
1079986
protected function colorize($message, $color = null)
    {
        if (!$color) {
            return $message;
        }

        // Create tag
        $tag = in_array($color, ['error', 'comment', 'info'], true) ? $color : 'fg='.$color;

        return sprintf('<%s>%s</%s>', $tag, $message, $tag);
    }
842460
public function removeColor(Color $color)
    {
        if ($this->colors->contains($color)) {
            $this->colors->removeElement($color);
        }
    }
899104
public function setTextColor($level, $color)
    {
        if (!is_array($level)) {
            $level = array($level);
        }

        foreach ($level as $loglevel) {
            $this->levelColors[$loglevel] = $color;
        }
    }