<canvas width="700" height="500"> </canvas>
selecione a cor de sua preferencia: <input type="color">
<script>
var paleta = document.querySelector('input');
var tela = document.querySelector("canvas");
var pincel = tela.getContext("2d");
var mouse = false;
pincel.fillStyle = "yellow";
pincel.fillRect(0, 0, 700, 500);
function desenhaMouse(evento){
var x = evento.pageX - tela.offsetLeft;
var y = evento.pageY - tela.offsetTop;
if(mouse){
pincel.fillStyle = paleta.value;;
pincel.beginPath();
pincel.arc(x, y, 10, 0, 2*3.14);
pincel.fill();
}
}
function altera(){
mouse = !mouse;
}
tela.onmousemove = desenhaMouse;
tela.onmousedown = altera;
tela.onmouseup = altera;
</script>