def scale_color(color, kwargs)
      assert_type color, :Color, :color
      with = Sass::Util.map_hash(
        "red" => 255,
        "green" => 255,
        "blue" => 255,
        "saturation" => 100,
        "lightness" => 100,
        "alpha" => 1
      ) do |name, max|
        val = kwargs.delete(name)
        next unless val
        assert_type val, :Number, name
        assert_unit val, '%', name
        Sass::Util.check_range("$#{name}: Amount", -100..100, val, '%')

        current = color.send(name)
        scale = val.value / 100.0
        diff = scale > 0 ? max - current : current
        [name.to_sym, current + diff * scale]
      end

      unless kwargs.empty?
        name, val = kwargs.to_a.first
        raise ArgumentError.new("Unknown argument $#{name} (#{val})")
      end

      color.with(with)
    end
def scale_color(color, kwargs)
      assert_type color, :Color, :color
      with = Sass::Util.map_hash(
        "red" => 255,
        "green" => 255,
        "blue" => 255,
        "saturation" => 100,
        "lightness" => 100,
        "alpha" => 1
      ) do |name, max|
        val = kwargs.delete(name)
        next unless val
        assert_type val, :Number, name
        assert_unit val, '%', name
        Sass::Util.check_range("$#{name}: Amount", -100..100, val, '%')

        current = color.send(name)
        scale = val.value / 100.0
        diff = scale > 0 ? max - current : current
        [name.to_sym, current + diff * scale]
      end

      unless kwargs.empty?
        name, val = kwargs.to_a.first
        raise ArgumentError.new("Unknown argument $#{name} (#{val})")
      end

      color.with(with)
    end
Fluidly scales one or more properties of a color. Unlike
 \{#adjust_color adjust-color}, which changes a color's properties by fixed
 amounts, \{#scale_color scale-color} fluidly changes them based on how
 high or low they already are. That means that lightening an already-light
 color with \{#scale_color scale-color} won't change the lightness much,
 but lightening a dark color by the same amount will change it more
 dramatically. This has the benefit of making `scale-color($color, ...)`
 have a similar effect regardless of what `$color` is.

 For example, the lightness of a color can be anywhere between `0%` and
 `100%`. If `scale-color($color, $lightness: 40%)` is called, the resulting
 color's lightness will be 40% of the way between its original lightness
 and 100. If `scale-color($color, $lightness: -40%)` is called instead, the
 lightness will be 40% of the way between the original and 0.

 This can change the red, green, blue, saturation, value, and alpha
 properties. The properties are specified as keyword arguments. All
 arguments should be percentages between `0%` and `100%`.

 All properties are optional. You can't specify both RGB properties
 (`$red`, `$green`, `$blue`) and HSL properties (`$saturation`, `$value`)
 at the same time.

 @example
   scale-color(hsl(120, 70%, 80%), $lightness: 50%) => hsl(120, 70%, 90%)
   scale-color(rgb(200, 150%, 170%), $green: -40%, $blue: 70%) => rgb(200, 90, 229)
   scale-color(hsl(200, 70%, 80%), $saturation: -90%, $alpha: -30%) => hsla(200, 7%, 80%, 0.7)
 @overload scale_color($color, [$red], [$green], [$blue], [$saturation], [$lightness], [$alpha])
   @param $color [Sass::Script::Value::Color]
   @param $red [Sass::Script::Value::Number]
   @param $green [Sass::Script::Value::Number]
   @param $blue [Sass::Script::Value::Number]
   @param $saturation [Sass::Script::Value::Number]
   @param $lightness [Sass::Script::Value::Number]
   @param $alpha [Sass::Script::Value::Number]
 @return [Sass::Script::Value::Color]
 @raise [ArgumentError] if any parameter is the wrong type or out-of
   bounds, or if RGB properties and HSL properties are adjusted at the
   same time