def change_color(color, kwargs)
      assert_type color, :Color, :color
      with = Sass::Util.map_hash(
        'red' => ['Red value', 0..255],
        'green' => ['Green value', 0..255],
        'blue' => ['Blue value', 0..255],
        'hue' => [],
        'saturation' => ['Saturation', 0..100, '%'],
        'lightness' => ['Lightness', 0..100, '%'],
        'alpha' => ['Alpha channel', 0..1]
      ) do |name, (desc, range, unit)|
        val = kwargs.delete(name)
        next unless val
        assert_type val, :Number, name

        if range
          val = Sass::Util.check_range(desc, range, val, unit)
        else
          val = val.value
        end

        [name.to_sym, val]
      end

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

      color.with(with)
    end
def change_color(color, kwargs)
      assert_type color, :Color, :color
      with = Sass::Util.map_hash(
        'red' => ['Red value', 0..255],
        'green' => ['Green value', 0..255],
        'blue' => ['Blue value', 0..255],
        'hue' => [],
        'saturation' => ['Saturation', 0..100, '%'],
        'lightness' => ['Lightness', 0..100, '%'],
        'alpha' => ['Alpha channel', 0..1]
      ) do |name, (desc, range, unit)|
        val = kwargs.delete(name)
        next unless val
        assert_type val, :Number, name

        if range
          val = Sass::Util.check_range(desc, range, val, unit)
        else
          val = val.value
        end

        [name.to_sym, val]
      end

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

      color.with(with)
    end
Changes one or more properties of a color. This can change the red, green,
 blue, hue, saturation, value, and alpha properties. The properties are
 specified as keyword arguments, and replace the color's current value for
 that property.

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

 @example
   change-color(#102030, $blue: 5) => #102005
   change-color(#102030, $red: 120, $blue: 5) => #782005
   change-color(hsl(25, 100%, 80%), $lightness: 40%, $alpha: 0.8) => hsla(25, 100%, 40%, 0.8)
 @overload change_color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])
   @param $color [Sass::Script::Value::Color]
   @param $red [Sass::Script::Value::Number] The new red component for the
     color, within 0 and 255 inclusive
   @param $green [Sass::Script::Value::Number] The new green component for
     the color, within 0 and 255 inclusive
   @param $blue [Sass::Script::Value::Number] The new blue component for the
     color, within 0 and 255 inclusive
   @param $hue [Sass::Script::Value::Number] The new hue component for the
     color, in degrees
   @param $saturation [Sass::Script::Value::Number] The new saturation
     component for the color, between `0%` and `100%` inclusive
   @param $lightness [Sass::Script::Value::Number] The new lightness
     component for the color, within `0%` and `100%` inclusive
   @param $alpha [Sass::Script::Value::Number] The new alpha component for
     the color, within 0 and 1 inclusive
 @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