<canvas width="600" height="400"></canvas>
<script>
var tela = document.querySelector("canvas");
var pincel = tela.getContext('2d');
function retangulo(cor,px,py,largura,tamanho){
pincel.fillStyle = cor
pincel.fillRect(px,py,largura,tamanho);
}
retangulo('darkgreen',50,50,350, 300 );
retangulo('black',100,100,90,90);
retangulo('black',260,100,90,90);
retangulo('black',190,190,70,100);
retangulo('black',150,240,40,110);
retangulo('black',260,240,40,110);
</script>