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 / 10
            make new range
            rangecolor = map[loc]
            rangestart = loc / 10
        

To work, the values have to be in a relatively small range as in your sample data.