The variety of ways to set a color
@param ColorInterface | string | integer | int[] $color - Many options for initializing a color object - SEE CONSTRUCTOR
9109
public function setColor($color) {

        // if null is passed in, then just leave everything null
        if (!is_null($color)) {

            // if it an instance of another color
            if ($color instanceof ColorInterface) {

                // save the name
                $this->name = $color->getName();

                // save the xterm code
                $this->XTermCode = $color->getXTermCode();

                // save the RGB
                $this->RGB = $color->getRGB();

                // save the ansi code
                $this->ANSICode = $color->getANSICode();

                // if it is string, then it is a color name (maybe)
            } else if (is_string($color)) {

                if (Colors::isValidColorName($color)) {

                    $this->name = Colors::stripName($color);

                    // get the code for that name
                    $this->XTermCode = Colors::getXTermCode($this->name);

                    // save the RGB
                    $this->RGB = Colors::getRGB($this->name);

                    // get the ANSI code
                    $this->ANSICode = Colors::getANSICode($this->name);

                }

                // if it is an integer, then it is likely a xterm code
            } else if (is_int($color)) {

                // if it is between 0 and 255
                if ($color >= 0 && $color <= 255) {

                    // save this code
                    $this->XTermCode = $color;

                    // get the RGB for it
                    $this->name = Colors::getColorIndexForXTermCode($this->XTermCode);

                    // get the RGB
                    $this->RGB = Colors::getRGB($this->name);

                    // get the ANSI Code
                    $this->ANSICode = Colors::getANSICode($this->name);
                }

                // if it is an RGB array
            } else if (is_array($color)) {

                // there must be three items in the array
                if (count($color) === 3) {

                    // save the RGB
                    $this->RGB = $color;

                    // match this RGB to some code
                    $this->name = Colors::matchRGB($this->RGB);

                    // get the nearest ANSI Code
                    $this->ANSICode = Colors::getANSICode($this->name);

                    // get the nearest XTerm code
                    $this->XTermCode = Colors::getXTermCode($this->name);

                }
            }

        // null was passed in
        } else {

            // set the color to be empty
            $this->setEmpty();
        }
    }
48292
protected function assignBgStyle(string $color)
    {
        if (in_array($color, $this->supported_bg_styles) === true) {
            $this->bg_color = $color;
        }
    }
433048
protected function assignTextStyle(string $color)
    {
        if (in_array($color, $this->supported_text_styles) === true) {
            $this->classes['card'][] = 'text-' . $color;
        }
    }
588034
public function setThemeColor(string $themeColor): self
    {
        $this->isValidColor($themeColor);

        $this->themeColor = $themeColor;

        return $this;
    }
1155768
public function setBackgroundColor(\Jdenticon\Color $color)
    {
        parent::setBackgroundColor($color);
        $this->canvas->backColor = $this->backgroundColor->toRgba();
    }
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;
    }
1058319
public void setColor(Color newColor) {
		if (newColor != null) {
			color.set(newColor);
		} else {
			color.set(DefaultColor);
		}
		colorF = color.toFloatBits();
		if (staticLight) dirty = true;
	}
1326912
public void setTextColor(final Color COLOR) {
        if (null == textColor) {
            _textColor = COLOR;
            fireSectionEvent(UPDATE_EVENT);
        } else {
            textColor.set(COLOR);
        }
    }
123951
public function setColor($x, $y, $color) {
		return imagesetpixel($this->image, $x, $y, $this->getColorWithRGB($color));
	}
725131
@Override
	public void setColor (Color newColor) {
		if (allowAlphaEdit == false) newColor.a = 1;
		//this method overrides setColor in Actor, not big deal we definitely don't need it
		setColor(newColor, true);
	}
161402
public function setColor(string $color): self
    {
        if (!preg_match("/^#([A-Fa-f0-9]{6})$/", $color)) {
            throw new \InvalidArgumentException($color. " is not a valid hexadecimal color");
        }
        $this->color = $color;
        return $this;
    }
596467
protected function initialize($color)
    {
        return list($this->red, $this->green, $this->blue) = str_split($color, 2);
    }
1350686
public function setBackground($color = null)
    {
        if (null === $color) {
            $this->background = null;
            return;
        }
        if (!isset(static::$availableBackgroundColors[$color])) {
            throw new \InvalidArgumentException(sprintf(
                'Invalid background color specified: "%s". Expected one of (%s)',
                $color,
                implode(', ', array_keys(static::$availableBackgroundColors))
            ));
        }
        $this->background = static::$availableBackgroundColors[$color];
    }
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;
	}
571834
public void setColor(@ColorInt int color) {
    this.color = color;
    if (!style.isFullyLoaded()) {
      // We are in progress of loading a new style
      return;
    }

    fillExtrusionLayer.setProperties(fillExtrusionColor(color));
  }
898717
protected function setColor(ColorInterface $color, bool $background = null): FormatterInterface
    {
        $name = $color->getName();
        $colors = $this->getColors();
        if (array_key_exists($name, $colors) === false) {
            throw new ColorNotSupported($color);
        }

        if ($background === true) {
            $this->background = $colors[$name] + 10;
        } else {
            $this->foreground = $colors[$name];
        }

        return $this;
    }
1210200
public final void setColor(@ColorInt final int color) {
        if (this.color != color) {
            this.color = color;
            persistInt(color);
            notifyChanged();
            adaptPreviewView();
        }
    }