asciidoctor / asciimath

Asciimath parser
MIT License
24 stars 16 forks source link

Made it so that the LaTeX renderer references colours by name when a name exists #44

Closed GarkGarcia closed 4 years ago

GarkGarcia commented 4 years ago

Note that I'm nothing making it so that color(name)(x) is rendered as {\color{name} x} (that would be incorrect). I'm only making it so color(#rrggbb)(x) is rendered as {\color{<name of #rrggbb>} x} instead of {\color[RGB]{rr, gg, bb} x} whenever #rrggbb has a name in the xcolor TeX package.

GarkGarcia commented 4 years ago

This is a follow up to https://github.com/asciidoctor/asciimath/issues/34#issuecomment-627300328.

GarkGarcia commented 4 years ago

For reference, the official documentation of xcolor can be found in here:

http://mirrors.ctan.org/macros/latex/contrib/xcolor/xcolor.pdf

The names included in COLOURS are taken from section 4.1 of the document.

pepijnve commented 4 years ago

Note that I'm nothing making it so that color(name)(x) is rendered as {\color{name} x}

Perfect. The way you've done this with a reverse rgb to name lookup table is indeed the way to go. The names in the parser reflect the MathML/HTML4 names/rgb values and those aren't necessarily the same in xcolor. :+1: