added map function to convert range of input values to range of rgb color values