Something like this?
//start color
int color = RGB(0, 0, 255);
//end color
int endcolor = RGB(254, 254, 1);
int speed = 100; //1 second (hah! not really)
//start color components (these change)
int r,g,b;
//final color components
int fr, fg, fb;
//how much to change each color every cycle
int dr, dg, db;
r = getR(color);
g = getG(color);
b = getB(color);
fr = getR(endcolor);
fg = getG(endcolor);
fb = getB(endcolor);
dr = (fr-r)/speed;
dg = (fg-g)/speed;
db = (fb-b)/speed;
while(r != fr && b != fb && g != fg)
{
r += dr;
g += dg;
b += db;
color = RGB(r, g, b);
RectFill(0, 0, 320, 340, color, screen);
showpage();
}
while(!b1)
{
RectFill(0, 0, 320, 340, color, screen);
showpage();
}
There is a problem, because of integer math the the ratios (dr, dg, db) won't be exactly perfect. Like how I had to fade to RGB(254, 254, 1) instead of RGB(255, 255, 0) for yellow