You may want to store 2 values for each colour component - the "base" values (which for orange, might be
rBase = 1,
gBase = 0.5,
bBase = 0), and then multiply these base values by the i variable (
rOut = rBase * i,
gOut = gBase * i,
bOut = bBase * i).
This may result in floating point values, so be sure to convert them to integers before applying them as the line colours.