Sets color
@param string $color Hexadecimal string representing label color, in RGB format
@return $this
12521
public function setColor($color)
    {
        $allowed_values = array('#ffffff', '#ffff01', '#ff6600', '#fe0000', '#9a0000', '#660066', '#0000fe', '#0099ff', '#01ffff', '#00ff33', '#349800', '#006634', '#666666', '#999999', '#e6e6e6', '#ffffcd', '#99ffff', '#ccff9a');
        if (!is_null($color) && (!in_array($color, $allowed_values))) {
            throw new \InvalidArgumentException("Invalid value for 'color', must be one of '#ffffff', '#ffff01', '#ff6600', '#fe0000', '#9a0000', '#660066', '#0000fe', '#0099ff', '#01ffff', '#00ff33', '#349800', '#006634', '#666666', '#999999', '#e6e6e6', '#ffffcd', '#99ffff', '#ccff9a'");
        }
        $this->container['color'] = $color;

        return $this;
    }
1024089
public function setColor($color)
    {
        $allowedValues = $this->getColorAllowableValues();
        if (!is_null($color) && !in_array($color, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'color', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['color'] = $color;

        return $this;
    }
1121440
public function addColor(Color $color)
    {
        if (!$this->colors->contains($color)) {
            $this->colors->add($color);
            $color->setInteractionSelection($this);
        }
    }
1118462
public static function fromHex(string $color): Color
    {
        if (!Validator::isValidHex($color)) {
            throw new InvalidColorException('Invalid hex value');
        }

        return new self(...array_values(self::hexToRgb($color)));
    }
1184194
private function getColorID($color)
    {
        list ($r, $g, $b) = explode(
            ' ',
            implode(' ', str_split(strtoupper(3 === strlen($color) ? $color . $color : $color), 2))
        );

        return imagecolorallocate($this->resource, hexdec($r), hexdec($g), hexdec($b));
    }
967290
protected function _set_stroke_colour($colour) {
    $colour[0] = round(255 * $colour[0]);
    $colour[1] = round(255 * $colour[1]);
    $colour[2] = round(255 * $colour[2]);

    if ( is_null($this->_last_stroke_color) || $color != $this->_last_stroke_color ) {
      $this->_pdf->SetDrawColor($color[0],$color[1],$color[2]);
      $this->_last_stroke_color = $color;
    }

  }
1264916
function set_color($color)
    {
        $col = $this->munge_color($color);

        if (is_null($col) || !isset($col["hex"])) {
            $color = "inherit";
        } else {
            $color = $col["hex"];
        }

        //see __set and __get, on all assignments clear cache, not needed on direct set through __set
        $this->_prop_cache["color"] = null;
        $this->_props["color"] = $color;
    }
334301
public static function colorToHex($color)
    {
        $colors = array(
            'maroon'    => '800000',
            'red'       => 'FF0000',
            'orange'    => 'FFA500',
            'yellow'    => 'FFFF00',
            'olive'     => '808000',
            'purple'    => '800080',
            'fuchsia'   => 'FF00FF',
            'white'     => 'FFFFFF',
            'lime'      => '00FF00',
            'green'     => '008000',
            'navy'      => '000080',
            'blue'      => '0000FF',
            'aqua'      => '00FFFF',
            'teal'      => '008080',
            'black'     => '000000',
            'silver'    => 'C0C0C0',
            'gray'      => '808080',
        );
        if (array_key_exists($color, $colors)) {
            return $colors[$color];
        }
        
        $color_pattern = '/rgb\((.*?)\)/';
        preg_match($color_pattern, $color, $matches);
        if (is_array($matches) && count($matches) > 0) {
            $rgb = explode(',', $matches[1]);
            if (is_array($rgb) && count($rgb) === 3) {
                return self::RGBToHex($rgb[0], $rgb[1], $rgb[2]);
            }
        }
        
        return $color;
    }
823915
public function setColor($color)
    {
        if (null === $color) {
            return $this;
        }

        $this->color = $this->convertColor($color);

        return $this;
    }
588034
public function setThemeColor(string $themeColor): self
    {
        $this->isValidColor($themeColor);

        $this->themeColor = $themeColor;

        return $this;
    }
232570
public function color($color){
        $style = array(
            'font' => array(
                'color' => array('rgb'=>$color)
            )
        );
        $this->engine->getActiveSheet()->getStyle("$this->x$this->y")->applyFromArray($style);
        return $this;
    }
292711
private function setColor($color)
    {
        if (!isset(self::$colors[$color])) {
            throw new \InvalidArgumentException(sprintf(
                'Invalid foreground color specified: "%s". Expected one of (%s)',
                $color,
                implode(', ', array_keys(self::$colors))
            ));
        }

        $this->color = self::$colors[$color];
    }
712048
public function setColor($color)
	{
		if (is_array($color))
		{
			$this->color[0] = $color[0];
			$this->color[1] = $color[1];
			$this->color[2] = $color[2];
		}
		else
		{
			$color = ltrim($color, '#');

			$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;
	}
208334
protected function toHex($color)
	    {
	        $rgb = $this->getRGBComponents($color);

	        return sprintf('#%02X%02X%02X', $rgb[0], $rgb[1], $rgb[2]);
	    }
1178309
function fill($color = '#000000') {
        $rgba = $this->normalize_color($color);
        $fill_color = imagecolorallocatealpha($this->image, $rgba['r'], $rgba['g'], $rgba['b'], $rgba['a']);
        imagealphablending($this->image, false);
        imagesavealpha($this->image, true);
        imagefilledrectangle($this->image, 0, 0, $this->width, $this->height, $fill_color);
        return $this;
    }
1159564
private function setTransparent($color)
    {
        $this->transparentColor = $color;
        imagecolortransparent($this->resource, (int)$this->transparentColor);
    }
73014
public function colors($colors)
    {
        $colors = Helper::toType($colors, 'array');
        $this->props['colors'] = array_merge($this->props['colors'], $colors);
        return $this;
    }