Bandara Bandara - 1 month ago 5
Javascript Question

How to check is there any background color on canvas?

Following method use to set background color to canvas and I use fabricJS.

canvas.setBackgroundColor(event.color.toHex());


before going to next step, I need to check is there any background color on my canvas. How I do this?

Answer

Try this

if(canvas.backgroundColor){
     alert(canvas.backgroundColor);
}