I want to include colorised icons in a mdframed environment. Since I think that in the near future I will probably need the icons to have varying colours, I'd like to use the \color{...}{\includegraphics{...}} functionality described in the xcolor manual (Sec. 2.15.3)

I have seen this working before when a PDF graphic was already provided, but I'm unsure how I can prepare such a file from scratch myself.

For example, take the open source "material" icons provided by Google. One can download one of their SVG files, open it in Inkscape and save it in PDF format. Now the file appears to be black and white only, and indeed the SVG source code conists of little information at all (no colour info as far as I can see), but still I am unable to produce a colour overlay with \color.

I suspect that the issue is rather technical and no concrete line of code is relevant, but a short MWE would be:

    \includegraphics{arrow.pdf} \textcolor{green}{\includegraphics{arrow.pdf}}

Where arrow.pdf is a manually exported version of the SVG file linked above. This MWE produces two black versions of the icon. The second one is not green:

two black arrows facing down

So maybe we should expect that there is some kind of colour or transparency information that prohibits \color. What I tried so far:

  • using the preflight toolbox of Adobe Acrobat to export black and white PDFs
  • using the colorise functionality of Adobe Illustrator
  • using the XML editor of Inkscape

So maybe there are xcolor or TeX-specifig criteria toward the PDF files. But which ones?

  • This section in xcolor talks about postcript files, not pdf files. – Ignasi Jun 20 '16 at 9:24
  • Good point! Unfortunately, the problem stays the same when I export the SVG files as EPS using Inkscape. – Felix Emanuel Jun 20 '16 at 10:00
  • 1
    Have a look at Heiko Oberdiek's answer to this question: tex.stackexchange.com/a/119380/61499. Not obvious at all. BTW: You should provide arrow.pdf as well to making it a complete MWE. – Timm Jun 22 '16 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.