Fabric.js: transparent canvas background color

Does anyone know how to clear the background color of a Fabric.js canvas once you have used the setBackgroundColor method?

Basically, I want to go back to โ€œmode without background colorโ€ so that it shows the div behind.

+4
source share
1 answer

You can do this with setBackgroundColor.

canvas.setBackgroundColor('', canvas.renderAll.bind(canvas));

Since the stretch request 1445 ( https://github.com/kangax/fabric.js/pull/1445 ) is merged, you can also set backgroundColor to null.

canvas.setBackgroundColor(null, canvas.renderAll.bind(canvas));
+5
source

Source: https://habr.com/ru/post/1546339/


All Articles