for (var w=0; w<canvas.width; w+=10) {

for (var h=0; h<canvas.height; h+=10) {

context.beginPath();

context.moveTo(w,h);

context.lineTo(canvas.width - w, canvas.height - h);

var R = Math.round( w / canvas.width * 255 );

var B = Math.round( h / canvas.height * 255 );

// var G = 255 - Math.round( (w*h) / (canvas.width * canvas.height) * 255);

var G = Math.round( (w*h) / (canvas.width * canvas.height) * 255);
var A = 0.5;

context.strokeStyle = "rgba("+R+","+G+","+B+","+A+")";

context.stroke();

}
}