Sets background color in RGB format.

@access public
@param  int $red   Red.
@param  int $green Green.
@param  int $blue  Blue.
@return \GImage\Figure
359874
public function setBackgroundColor($red, $green, $blue)
    {
        $this->red = $red;
        $this->green = $green;
        $this->blue = $blue;

        return $this;
    }
577543
public function set(Int $index, String $rgb = NULL) : GD
    {
        $rgb = $index . '|' . ($this->getColors($this->color ?? $rgb));

        $this->getImageColor($rgb, 'imagecolorset');

        return $this;
    }
821120
private function setBackgroundColor($backgroundColor)
    {
        $this->backgroundColor = (int)$backgroundColor;
        $tmpImage = imagecreatetruecolor($this->width, $this->height);
        imagefilledrectangle($tmpImage, 0, 0, $this->width, $this->height, $this->backgroundColor);
        imagecopy($tmpImage, $this->resource, 0, 0, 0, 0, $this->width, $this->height);
        $this->resource = $tmpImage;
    }
807207
public function setSelfIlluminationColor($red, $green, $blue)
    {
        $this->selfIlluminationColor = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
        return $this;
    }
566403
public function setRed(float $red, float $scale = 1.)
    {
        $this->red = $this->setComponent($red, $scale);
        return $this;
    }
692472
public function setColor($red = null, $green = null, $blue = null)
    {
        $deferred = new Deferred();

        if (is_null($red)) {
            $this->setAttribute('color', 0);

            $deferred->resolve();

            return $deferred->promise();
        }

        $this->setAttribute('color', $red * 16 ** 4 + $green * 16 ** 2 + $blue);

        $deferred->resolve();

        return $deferred->promise();
    }
1171214
public function setColor( $key, $r, $g, $b, $alpha = 0, $range = 0 )
	{
		#	Set color
	
		if( !in_array( $key, array( 'background', 'background_text', 'front_text' ) ) )
			throw new CaptchaException( __METHOD__ . '($key, ) must be one of( background, background_text, front_text ).' );
		
		if( !is_numeric( $r ) || !is_numeric( $g ) || !is_numeric( $b ) || !is_numeric( $alpha ) || !is_numeric( $range ) )
			throw new CaptchaException( __METHOD__ . '( , $args ) second argument and the followers must be numeric values.' );

		# set values
		$property = ( $key == 'background' ) ? '_image_info' : '_' . $key;


		$this->{$property}['color']				= array( $r, $g, $b, $alpha );
		$this->{$property}['color']['range'] 	= $range;
		
		return $this;
		# Method End
	}
737126
function set_background_color($color)
    {
        $col = $this->munge_color($color);

        if (is_null($col)) {
            return;
            //$col = self::$_defaults["background_color"];
        }

        //see __set and __get, on all assignments clear cache, not needed on direct set through __set
        $this->_prop_cache["background_color"] = null;
        $this->_props["background_color"] = is_array($col) ? $col["hex"] : $col;
    }
1361717
function setColorRGB( $r, $g, $b, $force = 0 )
    {
        $this->setColor( eZMath::rgbToCMYK2( $r, $g, $b ), $force );
    }
205328
private static function setColors($wavelength, $rgb) {
        $red = $rgb["r"];
        $green = $rgb["g"];
        $blue = $rgb["b"];
        if ($wavelength >= 380 && $wavelength <= 439) {
            $red = - ($wavelength - 440.0) / (440.0 - 380.0);
            $green = 0.0;
            $blue = 1.0;
        } elseif ($wavelength >= 440 && $wavelength <= 489) {
            $red = 0.0;
            $green = ($wavelength - 440.0) / (490.0 - 440.0);
            $blue = 1.0;
        } elseif ($wavelength >= 490 && $wavelength <= 509) {
            $red = 0.0;
            $green = 1.0;
            $blue = - ($wavelength - 510.0) / (510.0 - 490.0);
        } elseif ($wavelength >= 510 && $wavelength <= 579) {
            $red = ($wavelength - 510.0) / (580.0 - 510.0);
            $green = 1.0;
            $blue = 0.0;
        } elseif ($wavelength >= 580 && $wavelength <= 644) {
            $red = 1.0;
            $green = - ($wavelength - 645.0) / (645.0 - 580.0);
            $blue = 0.0;
        } elseif ($wavelength >= 645 && $wavelength <= 780) {
            $red = 1.0;
            $green = 0.0;
            $blue = 0.0;
        } else {
            $red = 0.0;
            $green = 0.0;
            $blue = 0.0;
        }
        $rgb["r"] = $red;
        $rgb["g"] = $green;
        $rgb["b"] = $blue;
        return $rgb;
    }
666649
public function transparent(String $rgb) : GD
    {
        imagecolortransparent($this->canvas, $this->allocate($rgb));

        return $this;
    }
624502
public function setBackground($background)
    {
        if (isset($background)) {
            $background = strtolower($background);

            if (array_key_exists($background, $this->backgroundColors)) {
                $this->background = $background;
            }
        }

        return $this;
    }
852146
public void setRGB(int red, int green, int blue) throws Exception {

        if ((red < 0) || (red > 255)) {
            throw new Exception();
        }
        if ((green < 0) || (green > 255)) {
            throw new Exception();
        }
        if ((blue < 0) || (blue > 255)) {
            throw new Exception();
        }

        m_red = (float)red / 255;
        m_green = (float)green / 255;
        m_blue = (float)blue / 255;

        RGBtoHSV(m_red, m_green, m_blue);

        setHex();
    }
898048
public static function rgbToHsl($red, $green, $blue)
    {
        if (\min($red, $green, $blue) < 0) {
            throw new InvalidArgumentException('The parameters for rgbToHsl should be no less than 0');
        }

        if (\max($red, $green, $blue) > 0xFF) {
            throw new InvalidArgumentException('The parameters for rgbToHsl should be no more than 255');
        }

        $clrMin = \min($red, $green, $blue);
        $clrMax = \max($red, $green, $blue);
        $deltaMax = $clrMax - $clrMin;

        $L = ($clrMax + $clrMin) / 510;

        if (0 == $deltaMax) {
            $H = 0;
            $S = 0;
        } else {
            if (0.5 > $L) {
                $S = $deltaMax / ($clrMax + $clrMin);
            } else {
                $S = $deltaMax / (510 - $clrMax - $clrMin);
            }

            if ($clrMax === $red) {
                $H = ($green - $blue) / (6.0 * $deltaMax);

                if (0 > $H) {
                    $H += 1.0;
                }
            } elseif ($clrMax === $green) {
                $H = 1 / 3 + ($blue - $red) / (6.0 * $deltaMax);
            } else {
                $H = 2 / 3 + ($red - $green) / (6.0 * $deltaMax);
            }
        }

        return array(
            (float) ($H * 360 % 360),
            (float) ($S * 100),
            (float) ($L * 100),
        );
    }
1034957
private function setPixel($r, $g, $b, $a = null)
    {
        $a = $a ?? 1;

        return $this->pixel = new \ImagickPixel(
            sprintf('rgba(%d, %d, %d, %.2F)', $r, $g, $b, $a)
        );
    }
1281389
public function setGreen(float $green, float $scale = 1.)
    {
        $this->green = $this->setComponent($green, $scale);
        return $this;
    }
973992
public function mix() : Color
    {
        foreach ($this->colors as $color) {
            $colors  = $color->dec();
            $reds  []= $colors[0];
            $greens[]= $colors[1];
            $blues []= $colors[2];
        }

        $red   = dechex( round(array_sum($reds)  / count($reds)  ) );
        $green = dechex( round(array_sum($greens)/ count($greens)) );
        $blue  = dechex( round(array_sum($blues) / count($blues) ) );

        // pad single-digit hexadecimals with leading zero
        foreach ([&$red, &$green, &$blue] as &$color) {
            if (strlen($color) === 1) {
                $color = "0$color";
            }
        }

        return new Color($red.$green.$blue);
    }