Calculation of RGB values given min and max values
Calculations like these can be hard to understand, so I would try to strive for something that is clearly correct, not just correct.

What I would do:


normalize the value from \$[min, max]\$ to \$[0, 2]\$
realize that the "strength" of a color is \$1 - |value - color|\$ (where \$color\$ is \$0\$ for blue, \$1\$ for green and \$2\$ for red), so compute that
clip the computer strength to remove negative numbers
finally multiply it by \$255\$ and convert to int (while also rounding the value, to avoid bias towards smaller numbers)


In code:

public static RgbValues GetRgbValues(float minimum, float maximum, float value)
{
    var normalizedValue = Normalize(minimum, maximum, value);

    return new RgbValues
    {
        Blue = Distance(normalizedValue, 0),
        Green = Distance(normalizedValue, 1),
        Red = Distance(normalizedValue, 2)
    };
}

private static float Normalize(float minimum, float maximum, float value)
{
    return (value - minimum) / (maximum - minimum) * 2;
}

private static int Distance(float value, float color)
{
    var distance = Math.Abs(value - color);

    var colorStrength = 1 - distance;

    if (colorStrength &lt; 0)
        colorStrength = 0;

    return (int)Math.Round(colorStrength * 255);
}


This code is longer than the original, but I think it's also clearer about what it does. I didn't figure out what your code did until I read the SO question, I think it's much more likely I would have succeeded with this code.