size(400,400); color left = color(232,154,28); // orange color right = color(155,16,198); // purple for (int x=0; x < width; x++) { float percent = 1.0 * x / (width-1); // force floating-point arithmetic float r = (1-percent) * red(left) + percent*red(right); float g = (1-percent) * green(left) + percent*green(right); float b = (1-percent) * blue(left) + percent*blue(right); stroke(r,g,b); line(x, 0, x, height); }