MathJax-node
MathJax-node copied to clipboard
Setting background-color style to SVG element
I need to set background-color style to SVG element.
How can I do it?
It is not clear what your use case really is. Are you trying to set the background for ALL the SVG elements created by MathJax? If so, you can use CSS to do that. Something like
.MathJax_SVG > svg {
background-color: red;
}
If you want to control the color from within the expression, that will depend on the input format you are using; you don't stay which that is.
For TeX, you can use \bbox[red]{...} to make the math in its argument have a red background. You may want to use \bbox[red; padding: 3px]{...} to increase the space around the expression that is red.
You can also use \require{color} \colorbox{red}{...}.
For MathML, you would use the attribute mathbackground="red" on any element to make the background red for its contents. It can be used on the <math> tag to make the whole expression have a red background.
There is no mechanism in AsciiMath for making a colored background.