We do not always need to stick to a black rectangle when using fillRect(). The color inside a rectangle depends on the fillStyle property of the canvas context. By changing this property, we can set the rectangle to any color we want.
Take a look at this example:
In this example, the rectangle is filled with the color thistle, as specified by the fillStyle property. Try changing the value of fillStyle to a colour of your choice.