OK, I don't know if this is going to make much sense but here is my attempt!

Let the small range be from "a" to "b". Let the big range be from "A" to "B". Then we want the ratios between the color values to remain the same. Here is what I tried. Let "x" be a point between "a" and "b", it will be one of the color values in the initial range. Then we map it to a point "y" in the big range in such a way that the distance from "x" to "a" relative to the whole range ("a" to "b") is the same as the distance from "A" to "y" relative the whole big range.

Here is the mathematical way of saying it:

Solving for y, you get:

Similarly, if you want to go the other way, you just use

In your case you have a = 57, b = 205 and A = 0 and B = 255. Then you get