In this article, we are going to see how to change the background color of the canvas-like text using FabricJS. The canvas means text written is movable, rotatable, resizable, and can be stretched. But in this article, we will change the background color. Further, the text itself cannot be edited like a textbox.
fabric.text(text :string, textBackgroundColor:string);
Parameters: This function accepts two parameters as mentioned above and described below:
- text: It specifies the text.
- textBackgroundColor: It specifies the background color.
Program: This example uses FabricJS to change background color of canvas-like text as given below.
- How to change the background color of the active nav-item?
- HTML | Change Background color using onmouseover property
- How to change background color of a canvas circle using Fabric.js ?
- Set the opacity only to background color not on the text in CSS
- How to change selection background color of a canvas circle using Fabric.js ?
- How to change the color of selected text using CSS ?
- How to change border-color of a canvas text using Fabric.js ?
- How to change an element color based on value of the color picker value on click?
- How to change an element color based on value of the color picker value using onclick?
- Difference between background and background-color
- Text Animation with changing the color of the text using HTML & CSS
- How to set the SVG background color ?
- How to change the background image using jQuery ?
- CSS | background-color Property
- How to use text as background using CSS ?
- How to change SVG color ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.