def with(attrs)
      attrs = attrs.reject {|_k, v| v.nil?}
      hsl = !([:hue, :saturation, :lightness] & attrs.keys).empty?
      rgb = !([:red, :green, :blue] & attrs.keys).empty?
      if hsl && rgb
        raise ArgumentError.new("Cannot specify HSL and RGB values for a color at the same time")
      end

      if hsl
        [:hue, :saturation, :lightness].each {|k| attrs[k] ||= send(k)}
      elsif rgb
        [:red, :green, :blue].each {|k| attrs[k] ||= send(k)}
      else
        # If we're just changing the alpha channel,
        # keep all the HSL/RGB stuff we've calculated
        attrs = @attrs.merge(attrs)
      end
      attrs[:alpha] ||= alpha

      Color.new(attrs, nil, :allow_both_rgb_and_hsl)
    end
def with(attrs)
      attrs = attrs.reject {|_k, v| v.nil?}
      hsl = !([:hue, :saturation, :lightness] & attrs.keys).empty?
      rgb = !([:red, :green, :blue] & attrs.keys).empty?
      if hsl && rgb
        raise ArgumentError.new("Cannot specify HSL and RGB values for a color at the same time")
      end

      if hsl
        [:hue, :saturation, :lightness].each {|k| attrs[k] ||= send(k)}
      elsif rgb
        [:red, :green, :blue].each {|k| attrs[k] ||= send(k)}
      else
        # If we're just changing the alpha channel,
        # keep all the HSL/RGB stuff we've calculated
        attrs = @attrs.merge(attrs)
      end
      attrs[:alpha] ||= alpha

      Color.new(attrs, nil, :allow_both_rgb_and_hsl)
    end
Returns a copy of this color with one or more channels changed.
 RGB or HSL colors may be changed, but not both at once.

 For example:

     Color.new([10, 20, 30]).with(:blue => 40)
       #=> rgb(10, 40, 30)
     Color.new([126, 126, 126]).with(:red => 0, :green => 255)
       #=> rgb(0, 255, 126)
     Color.new([255, 0, 127]).with(:saturation => 60)
       #=> rgb(204, 51, 127)
     Color.new([1, 2, 3]).with(:alpha => 0.4)
       #=> rgba(1, 2, 3, 0.4)

 @param attrs [{Symbol => Numeric}]
   A map of channel names (`:red`, `:green`, `:blue`,
   `:hue`, `:saturation`, `:lightness`, or `:alpha`) to values
 @return [Color] The new Color object
 @raise [ArgumentError] if both RGB and HSL keys are specified