This demo shows that MathML color attributes (mathcolor and mathbackground) are now properly rendered in the editor.
MathML elements support color attributes like mathcolor (for text color) and
mathbackground (for background color). However, these attributes weren't being
rendered correctly in the editor because browsers don't natively apply these attributes as CSS styles.
We implemented a JavaScript-based solution that:
mathcolor and mathbackground attributescolor and background-color)The editor below contains MathML with color attributes. The colors should be visible:
<math xmlns="http://www.w3.org/1998/Math/MathML"> <mi mathcolor="red">x</mi> <mo>=</mo> <mn>5</mn> </math>
Expected: The variable x should appear in red.
<math xmlns="http://www.w3.org/1998/Math/MathML"> <mi mathbackground="yellow">y</mi> <mo>=</mo> <mn>10</mn> </math>
Expected: The variable y should have a yellow background.
<math xmlns="http://www.w3.org/1998/Math/MathML"> <mi mathcolor="red">a</mi> <mo>+</mo> <mi mathcolor="blue">b</mi> <mo>=</mo> <mi mathcolor="green">c</mi> </math>
Expected: a (red), b (blue), c (green).
<math xmlns="http://www.w3.org/1998/Math/MathML"> <mi mathcolor="#FF5733">x</mi> <mo>=</mo> <mn mathcolor="#33C1FF">42</mn> </math>
Expected: Custom hex colors applied to variables and numbers.
<math xmlns="http://www.w3.org/1998/Math/MathML"> <mi mathcolor="white" mathbackground="darkblue">important</mi> </math>
Expected: White text on dark blue background (highlighted effect).
applyMathMLColors() method to QuillKit.jsensureMathMLRendering() to automatically apply colorsMathPlugin.js to trigger color application on insertionmathcolor="red" for text colormathbackground="yellow" for background color