You need to use ..." + variable + "...
to let the String use the variable's values. As it is you were passing rgb( red, green, blue)
as the fillStyle, which then defaults to black because it's invalid
ctx.fillStyle = "rgb("+red+","+green+","+blue+")";