<canvas width="500" height="500"></canvas>
<script>
var tela = document.querySelector("canvas");
var pincel = tela.getContext("2d");
document.querySelector("canvas").style.backgroundColor = "green";//podemos preencher o backgrounf assim
pincel.fillStyle = "red";
pincel.fillRect(0,0,400,400);//ou assim
pincel.fillStyle = "black";
pincel.beginPath();
pincel.moveTo(100,100);
pincel.lineTo(100,450);
pincel.lineTo(450,450);
pincel.fill();
pincel.fillStyle = "white";
pincel.beginPath();
pincel.moveTo(150,225);
pincel.lineTo(150,400);
pincel.lineTo(325,400);
pincel.fill();
</script>