jgm/texmath

Feature request: color

corcoted opened this issue · 3 comments

It would be nice to be able to convert color attributes.

For example, from MathML

<math>
    <mi style="color: blue">m</mi>
    <mi>x</mi>
    <mo>+</mo>
    <mi style="color: red">c</mi>
</math>

to/from LaTeX (assuming the color or xcolor package is loaded...)

$$ {\color{blue}m}x+{\color{red}c} $$

which renders as

$$ {\color{blue}m}x+{\color{red}c} $$

Alternatively, (although MathJAX doesn't support this)

$$ \textcolor{blue}{m}x+\textcolor{red}{c} $$
jgm commented

Looks like in OMML color is added this way:

<m:r><w:rPr><w:color w:val="FF0000" w:themeColor="accent4"/></w:rPr><m:t>y</m:t></m:r>

(for red)

jgm commented

I added a branch color with a bit of work towards this.

One issue is how to store the colors. If we use strings, we'll need to convert them to RGB values for some formats. If we use RGB values, we'll need strings for some formats.