I'm trying to include some code using \usepackage{listings}. However the default look is not very pretty, so I want to customize it a bit. I've read some of the other posts about changing the layout of the code so I tried this:

    backgroundcolor=\color{yellow!20},% sets backgroundcolor
    \scriptsize \color{black},% basic font setting

But OliveGreen is undefined. Green is not good looking at all, so I would like to know how I can mix/create my own colors? Or maybe use another package with more standard colors in it.


The OliveGreen color is defined in dvipsnam.def, so you get it with


Alternatively, you can define it by stating


in your document preamble. In both cases, you can use the color by name where you wish.

With the dvipsnames option the OliveGreen color is defined in the CMYK model with what would be


but the same xcolor package will convert it to the rgb specification above.

This is what I get from the following test document:






which shows that the three ways of calling the color give the same result. However this can be different in the final printout, depending on the printer and the printer driver.

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.