If the data really is similar in scope to your sample data, you could create a map like this:
map = [0 .. 150]
for each color:
for loc range start * 10 to range finish * 10:
map[loc] = color
Then just walk through this map to generate the ranges
curcolor = none
for loc in map:
if map[loc] != curcolor:
if curcolor:
rangeend = loc
make new range
rangecolor = map[locl]
rangestart = loc
To work, the values have to be in a relatively small range as in your sample data.