In this article, we are going to see how to change the active background color of the text canvas using FabricJS. The canvas means text written is movable, rotatable, resizable, and can be stretched. But in this article, we will change the active background color. Further, the text itself cannot be edited like a textbox.
fabric.Text(text, selectionBackgroundColor: string);
Parameters: This function accepts two parameters as mentioned above and described below:
- text: It specifies the text to be written.
- selectionBackgroundColor: It specifies the color of the background when active.
Program: This example uses FabricJS to change the active background color of the text canvas. Note that we have to click on the text to see the active background color.