Alters the color by darkening it with the given percentage.

@param int $amount (0-100) Percentage with which to darken the color

@return Color
766366
public function darken($amount)
    {
        if ($amount < 0 || $amount > 100) {
            throw new InvalidArgumentException('The given amount must be between 0 and 100');
        }
        $amount /= 100;
        $this->lightness -= $this->lightness * $amount;

        return $this;
    }
940247
protected function modifyHours($amount, $invert = false)
	{
		if ($this->isFloat($amount))
		{
			return $this->modifyMinutes($amount * 60, $invert);
		}

		$interval = new DateInterval("PT{$amount}H");

		$this->modifyFromInterval($interval, $invert);

		return $this;
	}
1131925
protected function _color_luminance( $hex, $percent ) {
		$hex        = $this->_hex_normalization( $hex );
		$hue        = $this->_get_hue( $hex );
		$saturation = $this->_get_saturation( $hex );
		$luminance  = $this->_get_luminance( $hex );

		// Add luminance.
		$luminance += $percent * 100;
		$luminance  = ( 100 < $luminance ) ? 100 : $luminance;
		$luminance  = ( 0 > $luminance ) ? 0 : $luminance;

		$hex = $this->_convert_hsl_to_hex( $hue, $saturation, $luminance );
		return $hex;
	}
678600
public function spin($percent)
    {
        $color = $this->toHsl();
        $hue = ($color->hue() + $percent) % 360;
        return $color->hue($hue < 0 ? 360 + $hue : $hue)->back($this);
    }
1358801
public function incrementEsiRateLimit(int $amount = 1)
    {

        if ($this->getRateLimitKeyTtl() > 3) {

            cache()->increment($this->ratelimit_key, $amount);

        } else {

            cache()->set($this->ratelimit_key, $amount, carbon('now')
                ->addMinutes($this->ratelimit_duration));
        }
    }
813171
def lighten_color(color, amount):
    """"""
    color = [int(col + (255 - col) * amount) for col in hex_to_rgb(color)]
    return rgb_to_hex(color)
722841
private function LightenColor($color, $amount)
    {
        $newColor = $color + (0xff - $color) * $amount;
        return min(max(round($newColor), 0x00), 0xff);
    }
678258
public function blend(RGBColor $color, $amount)
    {
        return $this->setFromArray(array(
                    min(255, min($this->getRed(), $color->getRed()) + round(abs($color->getRed() - $this->getRed()) * $amount))
                    , min(255, min($this->getGreen(), $color->getGreen()) + round(abs($color->getGreen() - $this->getGreen()) * $amount))
                    , min(255, min($this->getBlue(), $color->getBlue()) + round(abs($color->getBlue() - $this->getBlue()) * $amount))
                    , min(100, min($this->getAlpha(), $color->getAlpha()) + round(abs($color->getAlpha() - $this->getAlpha()) * $amount))
        ));
    }
512278
public function darken(float $percentage): Color
    {
        $colors      = $this->getHsl();
        $colors['l'] -= $colors['l'] * ($percentage / 100);

        $darkerColor = self::hslToRgb($colors['h'], $colors['s'], max(round($colors['l'], 5), 0));

        return new self(...array_values($darkerColor));
    }
644287
protected static function modifyColor($rgbArr, $percent)
	{
		if (is_array($percent)) {
			foreach ($rgbArr as $i=>&$c) {
				$multiplier = $percent[$i] > 0 ? 1 + $percent[$i] / 100 : 1 - $percent[$i] / 100;
				$c = intval(round($c * $multiplier));
				if ($c > 255) $c = 255;
				if ($c < 0) $c = 0;
			}
		} else {
			$multiplier = $percent > 0 ? 1 + $percent / 100 : 1 - $percent / 100;
			foreach ($rgbArr as &$c) {
				$c = intval(round($c * $multiplier));
				if ($c > 255) $c = 255;
				if ($c < 0) $c = 0;
			}
		}

		return $rgbArr;
	}
1181811
public function increaseOffsetBy($amount)
    {
        if ($this->offset === null) {
            $this->offset = 0;
        }
        $this->offset += $amount;

        return $this;
    }
1203074
public function dec($field, $amount = 1) {
        $this->checkIncOrDecAmount($amount);

        $data = [$field => ['exp', "{$field} - {$amount}"]];
        return $this->update($data);
    }
168753
private static function roundAwayFromZero($amount)
    {
        $result = self::roundTowardsZero($amount);

        if (0 != bccomp($amount, $result, self::BCSCALE)) {
            if (1 == bccomp($amount, '0', self::BCSCALE)) {
                $result = bcadd($result, '1', self::BCSCALE);
            } elseif (-1 == bccomp($amount, '0', self::BCSCALE)) {
                $result = bcsub($result, '1', self::BCSCALE);
            }
        }

        return $result;
    }
333080
public function credit_adjustment($amount)
	{
		$amount = intval($amount);

		$this->credit = ($amount > 0 ? $amount : 0);

		$this->_saveBalance('update');
	}
1357755
public function tax($amount = null)
    {
        if (null === $amount) {
            return $this->tax;
        }

        $this->tax = $amount;

        return $this;
    }
152355
public function getCssGradient(Color $color, $amount = null)
    {
        // Get gradient colors
        if (self::isLight($color)) {
            $lightColor = $color->hex;
            $darkColor = self::darken($color->copy(), $amount)->hex;
        } else {
            $lightColor = self::lighten($color->copy(), $amount)->hex;
            $darkColor = $color->hex;
        }

        /* fallback/image non-cover color */
        $css = "background-color: #" . $color->hex . ";";

        /* IE Browsers */
        $css .= "filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#" . $lightColor . "', endColorstr='#" . $darkColor . "');";

        /* Safari 4+, Chrome 1-9 */
        $css .= "background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#" . $lightColor . "), to(#" . $darkColor . "));";

        /* Safari 5.1+, Mobile Safari, Chrome 10+ */
        $css .= "background-image: -webkit-linear-gradient(top, #" . $lightColor . ", #" . $darkColor . ");";

        /* Firefox 3.6+ */
        $css .= "background-image: -moz-linear-gradient(top, #" . $lightColor . ", #" . $darkColor . ");";

        /* IE 10+ */
        $css .= "background-image: -ms-linear-gradient(top, #" . $lightColor . ", #" . $darkColor . ");";

        /* Opera 11.10+ */
        $css .= "background-image: -o-linear-gradient(top, #" . $lightColor . ", #" . $darkColor . ");";

        // Return our CSS
        return $css;
    }
216958
public function shade($percent = 50)
    {
        $clone = clone $this;
        $black = $clone->toRgb()->red(0)->green(0)->blue(0);
        return $this->mix($black, $percent);
    }