This is fine for ramping red opposite to blue, but should not be called with step numbers not in the range 0 .. 255, as was pointed out:
void setLedColor(int colorStep)
{
int r = colorStep; // 256 would be 0, or off.
int b = 255 - colorStep; // -1, full on
int g = 0;
255 - 0 is 255, 255 - 255 is 0. A linear relationship.
255 - 256 is -1, or 255 when it is put where an unsigned char is expected.
a7