class Sass::Script::Color

def piecewise(other, operation)

def piecewise(other, operation)
  other_num = other.is_a? Number
  if other_num && !other.unitless?
    raise Sass::SyntaxError.new("Cannot add a number with units (#{other}) to a color (#{self}).") 
  end
  result = []
  for i in (0...3)
    res = rgb[i].send(operation, other_num ? other.value : other.rgb[i])
    result[i] = [ [res, 255].min, 0 ].max
  end
  with(:red => result[0], :green => result[1], :blue => result[2])
end