I need to do color interpolation of single color(not interpolation from one color to another color). For an example, if the color is yellow (dark yellow) should be interpolated to light yellow within certain duration, which means for each time step color interpolation should happen within the color and after that duration/time step reverse interpolation (light yellow to dark yellow) should start for certain time step, so this cycle continues until the user stops it through request command.
Basically I need to change brightness.
using color_t = std::array<float,3>;
// we can consider the value from 0-255
color_t yellow{1,1,0}; //as we increase yellow[2], it move towards light yellow
color_t green{0,1,0}; //dark green
// as we increase green[2],it move towards light green
color_t red{1,0,0};
// as we increase red[1],it move towards light red
color_t blue{0,0,1};
// as we increase blue[1],it move towards light blue
timeStepCount = 0;
time_step = 100;
void Linear(std::array<float,3>&color){
}
In the above function, RGB value (let's say for yellow) for color will be passed by reference, so for each time step, I need to get the different RGB values of the same color(as I mentioned above, from dark to light and light to dark).
I need to have the generic linear function, which should work for any color.
I know that I need to find a mathematical equation in order to solve it. But also okay if I get any solution to above mentioned colors.