[Tex/LaTex] Minted change text color

colorcommentsminted

I'm putting some C code on my report using minted package, but the comment color is blue while I want it to be gray.

\documentclass[11pt]{article}
\usepackage[cache=false]{minted}

\begin{document}
\begin{minted}[linenos]{c}
#include<Wire.h> //Wire library allow us to communicate with the I2C that we are using 
\end{minted}
\end{document}

Best Answer

There are various color schemas for minted, and several of them have gray comments. One example is the pastie style:

\documentclass[11pt]{article}
\usepackage[cache=false]{minted}
\usemintedstyle{pastie}

\begin{document}
\begin{minted}[linenos]{c}
#include<Wire.h> //Wire library allow us to communicate with the I2C
\end{minted}
\end{document}

enter image description here

You can find examples of the different styles on https://help.farbox.com/pygments.html. These examples are for Python highlighting, but the color of the comments (starting with # in Python) is the same for other languages such as C. You can also try out the styles on your own code easily on https://pygments.org/demo/. Note that not all of the styles may be available on your system (but probably they are).