For an unfilled rectangle, we use strokeRect instead:
ctx.strokeRect(20,20,50,50);
And to set the colour of the stroke, we do this:
ctx.strokeStyle="purple";
Try making another unfilled rectangle, in a different colour.
You can look up the standard colour names
here.
Remember that if you copy the line of code, you'll need to move the rectangle to a different location before you can see it.